Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterCalculateServiceServer(s grpc.ServiceRegistrar, srv CalculateServiceServer)
- type AverageRequest
- type AverageResponse
- type CalculateServiceClient
- type CalculateServiceServer
- type CalculateService_AverageClient
- type CalculateService_AverageServer
- type CalculateService_RandomNumsClient
- type CalculateService_RandomNumsServer
- type CalculateService_SumClient
- type CalculateService_SumServer
- type RandomNumsRequest
- type RandomNumsResponse
- type SumRequest
- type SumResponse
- type UnimplementedCalculateServiceServer
- type UnsafeCalculateServiceServer
Constants ¶
const ( CalculateService_Sum_FullMethodName = "/proto.CalculateService/Sum" CalculateService_RandomNums_FullMethodName = "/proto.CalculateService/RandomNums" CalculateService_Average_FullMethodName = "/proto.CalculateService/Average" )
Variables ¶
var CalculateService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "proto.CalculateService", HandlerType: (*CalculateServiceServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "Sum", Handler: _CalculateService_Sum_Handler, ClientStreams: true, }, { StreamName: "RandomNums", Handler: _CalculateService_RandomNums_Handler, ServerStreams: true, }, { StreamName: "Average", Handler: _CalculateService_Average_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "calculator.proto", }
CalculateService_ServiceDesc is the grpc.ServiceDesc for CalculateService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_calculator_proto protoreflect.FileDescriptor
Functions ¶
func RegisterCalculateServiceServer ¶
func RegisterCalculateServiceServer(s grpc.ServiceRegistrar, srv CalculateServiceServer)
Types ¶
type AverageRequest ¶
type AverageRequest struct { Num int64 `protobuf:"varint,1,opt,name=num,proto3" json:"num,omitempty"` // contains filtered or unexported fields }
func (*AverageRequest) Descriptor
deprecated
func (*AverageRequest) Descriptor() ([]byte, []int)
Deprecated: Use AverageRequest.ProtoReflect.Descriptor instead.
func (*AverageRequest) GetNum ¶
func (x *AverageRequest) GetNum() int64
func (*AverageRequest) ProtoMessage ¶
func (*AverageRequest) ProtoMessage()
func (*AverageRequest) ProtoReflect ¶
func (x *AverageRequest) ProtoReflect() protoreflect.Message
func (*AverageRequest) Reset ¶
func (x *AverageRequest) Reset()
func (*AverageRequest) String ¶
func (x *AverageRequest) String() string
type AverageResponse ¶
type AverageResponse struct { Average float32 `protobuf:"fixed32,1,opt,name=average,proto3" json:"average,omitempty"` // contains filtered or unexported fields }
func (*AverageResponse) Descriptor
deprecated
func (*AverageResponse) Descriptor() ([]byte, []int)
Deprecated: Use AverageResponse.ProtoReflect.Descriptor instead.
func (*AverageResponse) GetAverage ¶
func (x *AverageResponse) GetAverage() float32
func (*AverageResponse) ProtoMessage ¶
func (*AverageResponse) ProtoMessage()
func (*AverageResponse) ProtoReflect ¶
func (x *AverageResponse) ProtoReflect() protoreflect.Message
func (*AverageResponse) Reset ¶
func (x *AverageResponse) Reset()
func (*AverageResponse) String ¶
func (x *AverageResponse) String() string
type CalculateServiceClient ¶
type CalculateServiceClient interface { // 求和-客户端流式 Sum(ctx context.Context, opts ...grpc.CallOption) (CalculateService_SumClient, error) // 生成一定数量的随机数-服务端流式 RandomNums(ctx context.Context, in *RandomNumsRequest, opts ...grpc.CallOption) (CalculateService_RandomNumsClient, error) // 双向流式求平均值 Average(ctx context.Context, opts ...grpc.CallOption) (CalculateService_AverageClient, error) }
CalculateServiceClient is the client API for CalculateService 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.
func NewCalculateServiceClient ¶
func NewCalculateServiceClient(cc grpc.ClientConnInterface) CalculateServiceClient
type CalculateServiceServer ¶
type CalculateServiceServer interface { // 求和-客户端流式 Sum(CalculateService_SumServer) error // 生成一定数量的随机数-服务端流式 RandomNums(*RandomNumsRequest, CalculateService_RandomNumsServer) error // 双向流式求平均值 Average(CalculateService_AverageServer) error // contains filtered or unexported methods }
CalculateServiceServer is the server API for CalculateService service. All implementations must embed UnimplementedCalculateServiceServer for forward compatibility
type CalculateService_AverageClient ¶
type CalculateService_AverageClient interface { Send(*AverageRequest) error Recv() (*AverageResponse, error) grpc.ClientStream }
type CalculateService_AverageServer ¶
type CalculateService_AverageServer interface { Send(*AverageResponse) error Recv() (*AverageRequest, error) grpc.ServerStream }
type CalculateService_RandomNumsClient ¶
type CalculateService_RandomNumsClient interface { Recv() (*RandomNumsResponse, error) grpc.ClientStream }
type CalculateService_RandomNumsServer ¶
type CalculateService_RandomNumsServer interface { Send(*RandomNumsResponse) error grpc.ServerStream }
type CalculateService_SumClient ¶
type CalculateService_SumClient interface { Send(*SumRequest) error CloseAndRecv() (*SumResponse, error) grpc.ClientStream }
type CalculateService_SumServer ¶
type CalculateService_SumServer interface { SendAndClose(*SumResponse) error Recv() (*SumRequest, error) grpc.ServerStream }
type RandomNumsRequest ¶
type RandomNumsRequest struct { Num int64 `protobuf:"varint,1,opt,name=num,proto3" json:"num,omitempty"` // contains filtered or unexported fields }
func (*RandomNumsRequest) Descriptor
deprecated
func (*RandomNumsRequest) Descriptor() ([]byte, []int)
Deprecated: Use RandomNumsRequest.ProtoReflect.Descriptor instead.
func (*RandomNumsRequest) GetNum ¶
func (x *RandomNumsRequest) GetNum() int64
func (*RandomNumsRequest) ProtoMessage ¶
func (*RandomNumsRequest) ProtoMessage()
func (*RandomNumsRequest) ProtoReflect ¶
func (x *RandomNumsRequest) ProtoReflect() protoreflect.Message
func (*RandomNumsRequest) Reset ¶
func (x *RandomNumsRequest) Reset()
func (*RandomNumsRequest) String ¶
func (x *RandomNumsRequest) String() string
type RandomNumsResponse ¶
type RandomNumsResponse struct { Num int64 `protobuf:"varint,1,opt,name=num,proto3" json:"num,omitempty"` // contains filtered or unexported fields }
func (*RandomNumsResponse) Descriptor
deprecated
func (*RandomNumsResponse) Descriptor() ([]byte, []int)
Deprecated: Use RandomNumsResponse.ProtoReflect.Descriptor instead.
func (*RandomNumsResponse) GetNum ¶
func (x *RandomNumsResponse) GetNum() int64
func (*RandomNumsResponse) ProtoMessage ¶
func (*RandomNumsResponse) ProtoMessage()
func (*RandomNumsResponse) ProtoReflect ¶
func (x *RandomNumsResponse) ProtoReflect() protoreflect.Message
func (*RandomNumsResponse) Reset ¶
func (x *RandomNumsResponse) Reset()
func (*RandomNumsResponse) String ¶
func (x *RandomNumsResponse) String() string
type SumRequest ¶
type SumRequest struct { Num int64 `protobuf:"varint,1,opt,name=num,proto3" json:"num,omitempty"` // contains filtered or unexported fields }
func (*SumRequest) Descriptor
deprecated
func (*SumRequest) Descriptor() ([]byte, []int)
Deprecated: Use SumRequest.ProtoReflect.Descriptor instead.
func (*SumRequest) GetNum ¶
func (x *SumRequest) GetNum() int64
func (*SumRequest) ProtoMessage ¶
func (*SumRequest) ProtoMessage()
func (*SumRequest) ProtoReflect ¶
func (x *SumRequest) ProtoReflect() protoreflect.Message
func (*SumRequest) Reset ¶
func (x *SumRequest) Reset()
func (*SumRequest) String ¶
func (x *SumRequest) String() string
type SumResponse ¶
type SumResponse struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` // contains filtered or unexported fields }
func (*SumResponse) Descriptor
deprecated
func (*SumResponse) Descriptor() ([]byte, []int)
Deprecated: Use SumResponse.ProtoReflect.Descriptor instead.
func (*SumResponse) GetTotal ¶
func (x *SumResponse) GetTotal() int64
func (*SumResponse) ProtoMessage ¶
func (*SumResponse) ProtoMessage()
func (*SumResponse) ProtoReflect ¶
func (x *SumResponse) ProtoReflect() protoreflect.Message
func (*SumResponse) Reset ¶
func (x *SumResponse) Reset()
func (*SumResponse) String ¶
func (x *SumResponse) String() string
type UnimplementedCalculateServiceServer ¶
type UnimplementedCalculateServiceServer struct { }
UnimplementedCalculateServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedCalculateServiceServer) Average ¶
func (UnimplementedCalculateServiceServer) Average(CalculateService_AverageServer) error
func (UnimplementedCalculateServiceServer) RandomNums ¶
func (UnimplementedCalculateServiceServer) RandomNums(*RandomNumsRequest, CalculateService_RandomNumsServer) error
type UnsafeCalculateServiceServer ¶
type UnsafeCalculateServiceServer interface {
// contains filtered or unexported methods
}
UnsafeCalculateServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CalculateServiceServer will result in compilation errors.