grpc

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_target_proto protoreflect.FileDescriptor
View Source
var TargetService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "target.TargetService",
	HandlerType: (*TargetServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Hello",
			Handler:    _TargetService_Hello_Handler,
		},
		{
			MethodName: "Auth",
			Handler:    _TargetService_Auth_Handler,
		},
		{
			MethodName: "List",
			Handler:    _TargetService_List_Handler,
		},
		{
			MethodName: "Order",
			Handler:    _TargetService_Order_Handler,
		},
		{
			MethodName: "Stats",
			Handler:    _TargetService_Stats_Handler,
		},
		{
			MethodName: "Reset",
			Handler:    _TargetService_Reset_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "target.proto",
}

TargetService_ServiceDesc is the grpc.ServiceDesc for TargetService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterTargetServiceServer

func RegisterTargetServiceServer(s grpc.ServiceRegistrar, srv TargetServiceServer)

Types

type AuthRequest

type AuthRequest struct {
	Login string `protobuf:"bytes,1,opt,name=login,proto3" json:"login,omitempty"`
	Pass  string `protobuf:"bytes,2,opt,name=pass,proto3" json:"pass,omitempty"`
	// contains filtered or unexported fields
}

func (*AuthRequest) Descriptor deprecated

func (*AuthRequest) Descriptor() ([]byte, []int)

Deprecated: Use AuthRequest.ProtoReflect.Descriptor instead.

func (*AuthRequest) GetLogin

func (x *AuthRequest) GetLogin() string

func (*AuthRequest) GetPass

func (x *AuthRequest) GetPass() string

func (*AuthRequest) ProtoMessage

func (*AuthRequest) ProtoMessage()

func (*AuthRequest) ProtoReflect

func (x *AuthRequest) ProtoReflect() protoreflect.Message

func (*AuthRequest) Reset

func (x *AuthRequest) Reset()

func (*AuthRequest) String

func (x *AuthRequest) String() string

type AuthResponse

type AuthResponse struct {
	UserId int64  `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	Token  string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	// contains filtered or unexported fields
}

func (*AuthResponse) Descriptor deprecated

func (*AuthResponse) Descriptor() ([]byte, []int)

Deprecated: Use AuthResponse.ProtoReflect.Descriptor instead.

func (*AuthResponse) GetToken

func (x *AuthResponse) GetToken() string

func (*AuthResponse) GetUserId

func (x *AuthResponse) GetUserId() int64

func (*AuthResponse) ProtoMessage

func (*AuthResponse) ProtoMessage()

func (*AuthResponse) ProtoReflect

func (x *AuthResponse) ProtoReflect() protoreflect.Message

func (*AuthResponse) Reset

func (x *AuthResponse) Reset()

func (*AuthResponse) String

func (x *AuthResponse) String() string

type GRPCServer

type GRPCServer struct {
	UnimplementedTargetServiceServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(h *handler.Handler, logger *slog.Logger) *GRPCServer

func (*GRPCServer) Auth

func (s *GRPCServer) Auth(_ context.Context, request *AuthRequest) (*AuthResponse, error)

func (*GRPCServer) Hello

func (s *GRPCServer) Hello(ctx context.Context, request *HelloRequest) (*HelloResponse, error)

func (*GRPCServer) List

func (s *GRPCServer) List(_ context.Context, request *ListRequest) (*ListResponse, error)

func (*GRPCServer) Order

func (s *GRPCServer) Order(ctx context.Context, request *OrderRequest) (*OrderResponse, error)

func (*GRPCServer) Reset

func (s *GRPCServer) Reset(ctx context.Context, _ *ResetRequest) (*StatsResponse, error)

func (*GRPCServer) Stats

func (s *GRPCServer) Stats(ctx context.Context, _ *StatsRequest) (*StatsResponse, error)

type HelloRequest

type HelloRequest struct {
	Name      string               `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	SkipStats bool                 `protobuf:"varint,2,opt,name=skipStats,proto3" json:"skipStats,omitempty"`
	Sleep     *durationpb.Duration `protobuf:"bytes,3,opt,name=sleep,proto3" json:"sleep,omitempty"`
	// contains filtered or unexported fields
}

func (*HelloRequest) Descriptor deprecated

func (*HelloRequest) Descriptor() ([]byte, []int)

Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.

func (*HelloRequest) GetName

func (x *HelloRequest) GetName() string

func (*HelloRequest) GetSkipStats added in v0.1.2

func (x *HelloRequest) GetSkipStats() bool

func (*HelloRequest) GetSleep added in v0.1.2

func (x *HelloRequest) GetSleep() *durationpb.Duration

func (*HelloRequest) ProtoMessage

func (*HelloRequest) ProtoMessage()

func (*HelloRequest) ProtoReflect

func (x *HelloRequest) ProtoReflect() protoreflect.Message

func (*HelloRequest) Reset

func (x *HelloRequest) Reset()

func (*HelloRequest) String

func (x *HelloRequest) String() string

type HelloResponse

type HelloResponse struct {
	Hello string `protobuf:"bytes,1,opt,name=hello,proto3" json:"hello,omitempty"`
	// contains filtered or unexported fields
}

func (*HelloResponse) Descriptor deprecated

func (*HelloResponse) Descriptor() ([]byte, []int)

Deprecated: Use HelloResponse.ProtoReflect.Descriptor instead.

func (*HelloResponse) GetHello

func (x *HelloResponse) GetHello() string

func (*HelloResponse) ProtoMessage

func (*HelloResponse) ProtoMessage()

func (*HelloResponse) ProtoReflect

func (x *HelloResponse) ProtoReflect() protoreflect.Message

func (*HelloResponse) Reset

func (x *HelloResponse) Reset()

func (*HelloResponse) String

func (x *HelloResponse) String() string

type ListItem

type ListItem struct {
	ItemId int64 `protobuf:"varint,1,opt,name=item_id,json=itemId,proto3" json:"item_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ListItem) Descriptor deprecated

func (*ListItem) Descriptor() ([]byte, []int)

Deprecated: Use ListItem.ProtoReflect.Descriptor instead.

func (*ListItem) GetItemId

func (x *ListItem) GetItemId() int64

func (*ListItem) ProtoMessage

func (*ListItem) ProtoMessage()

func (*ListItem) ProtoReflect

func (x *ListItem) ProtoReflect() protoreflect.Message

func (*ListItem) Reset

func (x *ListItem) Reset()

func (*ListItem) String

func (x *ListItem) String() string

type ListRequest

type ListRequest struct {
	Token  string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	UserId int64  `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ListRequest) Descriptor deprecated

func (*ListRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.

func (*ListRequest) GetToken

func (x *ListRequest) GetToken() string

func (*ListRequest) GetUserId

func (x *ListRequest) GetUserId() int64

func (*ListRequest) ProtoMessage

func (*ListRequest) ProtoMessage()

func (*ListRequest) ProtoReflect

func (x *ListRequest) ProtoReflect() protoreflect.Message

func (*ListRequest) Reset

func (x *ListRequest) Reset()

func (*ListRequest) String

func (x *ListRequest) String() string

type ListResponse

type ListResponse struct {
	Result []*ListItem `protobuf:"bytes,1,rep,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*ListResponse) Descriptor deprecated

func (*ListResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.

func (*ListResponse) GetResult

func (x *ListResponse) GetResult() []*ListItem

func (*ListResponse) ProtoMessage

func (*ListResponse) ProtoMessage()

func (*ListResponse) ProtoReflect

func (x *ListResponse) ProtoReflect() protoreflect.Message

func (*ListResponse) Reset

func (x *ListResponse) Reset()

func (*ListResponse) String

func (x *ListResponse) String() string

type OrderRequest

type OrderRequest struct {
	Token  string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	UserId int64  `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	ItemId int64  `protobuf:"varint,3,opt,name=item_id,json=itemId,proto3" json:"item_id,omitempty"`
	// contains filtered or unexported fields
}

func (*OrderRequest) Descriptor deprecated

func (*OrderRequest) Descriptor() ([]byte, []int)

Deprecated: Use OrderRequest.ProtoReflect.Descriptor instead.

func (*OrderRequest) GetItemId

func (x *OrderRequest) GetItemId() int64

func (*OrderRequest) GetToken

func (x *OrderRequest) GetToken() string

func (*OrderRequest) GetUserId

func (x *OrderRequest) GetUserId() int64

func (*OrderRequest) ProtoMessage

func (*OrderRequest) ProtoMessage()

func (*OrderRequest) ProtoReflect

func (x *OrderRequest) ProtoReflect() protoreflect.Message

func (*OrderRequest) Reset

func (x *OrderRequest) Reset()

func (*OrderRequest) String

func (x *OrderRequest) String() string

type OrderResponse

type OrderResponse struct {
	OrderId int64 `protobuf:"varint,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
	// contains filtered or unexported fields
}

func (*OrderResponse) Descriptor deprecated

func (*OrderResponse) Descriptor() ([]byte, []int)

Deprecated: Use OrderResponse.ProtoReflect.Descriptor instead.

func (*OrderResponse) GetOrderId

func (x *OrderResponse) GetOrderId() int64

func (*OrderResponse) ProtoMessage

func (*OrderResponse) ProtoMessage()

func (*OrderResponse) ProtoReflect

func (x *OrderResponse) ProtoReflect() protoreflect.Message

func (*OrderResponse) Reset

func (x *OrderResponse) Reset()

func (*OrderResponse) String

func (x *OrderResponse) String() string

type ResetRequest

type ResetRequest struct {
	// contains filtered or unexported fields
}

func (*ResetRequest) Descriptor deprecated

func (*ResetRequest) Descriptor() ([]byte, []int)

Deprecated: Use ResetRequest.ProtoReflect.Descriptor instead.

func (*ResetRequest) ProtoMessage

func (*ResetRequest) ProtoMessage()

func (*ResetRequest) ProtoReflect

func (x *ResetRequest) ProtoReflect() protoreflect.Message

func (*ResetRequest) Reset

func (x *ResetRequest) Reset()

func (*ResetRequest) String

func (x *ResetRequest) String() string

type StatisticBodyResponse

type StatisticBodyResponse struct {
	Code200 map[int64]uint64 `` /* 157-byte string literal not displayed */
	Code400 uint64           `protobuf:"varint,2,opt,name=Code400,proto3" json:"Code400,omitempty"`
	Code500 uint64           `protobuf:"varint,3,opt,name=Code500,proto3" json:"Code500,omitempty"`
	// contains filtered or unexported fields
}

func (*StatisticBodyResponse) Descriptor deprecated

func (*StatisticBodyResponse) Descriptor() ([]byte, []int)

Deprecated: Use StatisticBodyResponse.ProtoReflect.Descriptor instead.

func (*StatisticBodyResponse) GetCode200

func (x *StatisticBodyResponse) GetCode200() map[int64]uint64

func (*StatisticBodyResponse) GetCode400

func (x *StatisticBodyResponse) GetCode400() uint64

func (*StatisticBodyResponse) GetCode500

func (x *StatisticBodyResponse) GetCode500() uint64

func (*StatisticBodyResponse) ProtoMessage

func (*StatisticBodyResponse) ProtoMessage()

func (*StatisticBodyResponse) ProtoReflect

func (x *StatisticBodyResponse) ProtoReflect() protoreflect.Message

func (*StatisticBodyResponse) Reset

func (x *StatisticBodyResponse) Reset()

func (*StatisticBodyResponse) String

func (x *StatisticBodyResponse) String() string

type StatsRequest

type StatsRequest struct {
	// contains filtered or unexported fields
}

func (*StatsRequest) Descriptor deprecated

func (*StatsRequest) Descriptor() ([]byte, []int)

Deprecated: Use StatsRequest.ProtoReflect.Descriptor instead.

func (*StatsRequest) ProtoMessage

func (*StatsRequest) ProtoMessage()

func (*StatsRequest) ProtoReflect

func (x *StatsRequest) ProtoReflect() protoreflect.Message

func (*StatsRequest) Reset

func (x *StatsRequest) Reset()

func (*StatsRequest) String

func (x *StatsRequest) String() string

type StatsResponse

type StatsResponse struct {
	Auth  *StatisticBodyResponse `protobuf:"bytes,1,opt,name=Auth,proto3" json:"Auth,omitempty"`
	List  *StatisticBodyResponse `protobuf:"bytes,2,opt,name=List,proto3" json:"List,omitempty"`
	Order *StatisticBodyResponse `protobuf:"bytes,3,opt,name=Order,proto3" json:"Order,omitempty"`
	Hello int64                  `protobuf:"varint,4,opt,name=Hello,proto3" json:"Hello,omitempty"`
	// contains filtered or unexported fields
}

func (*StatsResponse) Descriptor deprecated

func (*StatsResponse) Descriptor() ([]byte, []int)

Deprecated: Use StatsResponse.ProtoReflect.Descriptor instead.

func (*StatsResponse) GetAuth

func (x *StatsResponse) GetAuth() *StatisticBodyResponse

func (*StatsResponse) GetHello

func (x *StatsResponse) GetHello() int64

func (*StatsResponse) GetList

func (x *StatsResponse) GetList() *StatisticBodyResponse

func (*StatsResponse) GetOrder

func (x *StatsResponse) GetOrder() *StatisticBodyResponse

func (*StatsResponse) ProtoMessage

func (*StatsResponse) ProtoMessage()

func (*StatsResponse) ProtoReflect

func (x *StatsResponse) ProtoReflect() protoreflect.Message

func (*StatsResponse) Reset

func (x *StatsResponse) Reset()

func (*StatsResponse) String

func (x *StatsResponse) String() string

type TargetServiceClient

type TargetServiceClient interface {
	Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error)
	Auth(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthResponse, error)
	List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
	Order(ctx context.Context, in *OrderRequest, opts ...grpc.CallOption) (*OrderResponse, error)
	Stats(ctx context.Context, in *StatsRequest, opts ...grpc.CallOption) (*StatsResponse, error)
	Reset(ctx context.Context, in *ResetRequest, opts ...grpc.CallOption) (*StatsResponse, error)
}

TargetServiceClient is the client API for TargetService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type TargetServiceServer

type TargetServiceServer interface {
	Hello(context.Context, *HelloRequest) (*HelloResponse, error)
	Auth(context.Context, *AuthRequest) (*AuthResponse, error)
	List(context.Context, *ListRequest) (*ListResponse, error)
	Order(context.Context, *OrderRequest) (*OrderResponse, error)
	Stats(context.Context, *StatsRequest) (*StatsResponse, error)
	Reset(context.Context, *ResetRequest) (*StatsResponse, error)
	// contains filtered or unexported methods
}

TargetServiceServer is the server API for TargetService service. All implementations must embed UnimplementedTargetServiceServer for forward compatibility

type UnimplementedTargetServiceServer

type UnimplementedTargetServiceServer struct {
}

UnimplementedTargetServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedTargetServiceServer) Auth

func (UnimplementedTargetServiceServer) Hello

func (UnimplementedTargetServiceServer) List

func (UnimplementedTargetServiceServer) Order

func (UnimplementedTargetServiceServer) Reset

func (UnimplementedTargetServiceServer) Stats

type UnsafeTargetServiceServer

type UnsafeTargetServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeTargetServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TargetServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL