Documentation
¶
Overview ¶
Package sample provides sample grpc interface.
Index ¶
Constants ¶
const ( Sample_Func1_FullMethodName = "/Sample/Func1" Sample_Func2_FullMethodName = "/Sample/Func2" )
Variables ¶
var File_grpc_sample_sample_proto protoreflect.FileDescriptor
var Sample_ServiceDesc = grpc.ServiceDesc{ ServiceName: "Sample", HandlerType: (*SampleServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Func1", Handler: _Sample_Func1_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Func2", Handler: _Sample_Func2_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "grpc/sample/sample.proto", }
Sample_ServiceDesc is the grpc.ServiceDesc for Sample service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterSampleServer ¶
func RegisterSampleServer(s grpc.ServiceRegistrar, srv SampleServer)
Types ¶
type Reply ¶
type Reply struct {
Data1 int64 `protobuf:"varint,1,opt,name=data1,proto3" json:"data1,omitempty"`
Data2 string `protobuf:"bytes,2,opt,name=data2,proto3" json:"data2,omitempty"`
// contains filtered or unexported fields
}
func (*Reply) Descriptor
deprecated
func (*Reply) ProtoMessage ¶
func (*Reply) ProtoMessage()
func (*Reply) ProtoReflect ¶
func (x *Reply) ProtoReflect() protoreflect.Message
type Request ¶
type Request struct {
Data1 int64 `protobuf:"varint,1,opt,name=data1,proto3" json:"data1,omitempty"`
Data2 string `protobuf:"bytes,2,opt,name=data2,proto3" json:"data2,omitempty"`
// contains filtered or unexported fields
}
func (*Request) Descriptor
deprecated
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type SampleClient ¶
type SampleClient interface {
Func1(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Reply, error)
Func2(ctx context.Context, opts ...grpc.CallOption) (Sample_Func2Client, error)
}
SampleClient is the client API for Sample 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 NewSampleClient ¶
func NewSampleClient(cc grpc.ClientConnInterface) SampleClient
type SampleServer ¶
type SampleServer interface {
Func1(context.Context, *Request) (*Reply, error)
Func2(Sample_Func2Server) error
// contains filtered or unexported methods
}
SampleServer is the server API for Sample service. All implementations must embed UnimplementedSampleServer for forward compatibility
type Sample_Func2Client ¶
type Sample_Func2Server ¶
type Server ¶
type Server struct {
UnimplementedSampleServer
}
Server is struct that satisfies the implementServer interface and implements the function defined in protobuf IDL.
func (*Server) Func2 ¶
func (this *Server) Func2(stream Sample_Func2Server) error
Func2 is implementation of the function defined in protobuf IDL.
func (*Server) RegisterServer ¶
RegisterServer is function to register in grpc server.
the function we need to call is Register{service name of proto file}Server
type UnimplementedSampleServer ¶
type UnimplementedSampleServer struct {
}
UnimplementedSampleServer must be embedded to have forward compatible implementations.
func (UnimplementedSampleServer) Func2 ¶
func (UnimplementedSampleServer) Func2(Sample_Func2Server) error
type UnsafeSampleServer ¶
type UnsafeSampleServer interface {
// contains filtered or unexported methods
}
UnsafeSampleServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SampleServer will result in compilation errors.