Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var File_hello_proto protoreflect.FileDescriptor
Functions ¶
func RegisterHelloServer ¶
func RegisterHelloServer(s *grpc.Server, srv HelloServer)
Types ¶
type HelloClient ¶
type HelloClient interface { SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) // 增加一个支持双向流的方法 Channel(ctx context.Context, opts ...grpc.CallOption) (Hello_ChannelClient, error) }
HelloClient is the client1 API for Hello service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewHelloClient ¶
func NewHelloClient(cc grpc.ClientConnInterface) HelloClient
type HelloRequest ¶
type HelloRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,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) 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 { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
定义响应结构体
func (*HelloResponse) Descriptor
deprecated
func (*HelloResponse) Descriptor() ([]byte, []int)
Deprecated: Use HelloResponse.ProtoReflect.Descriptor instead.
func (*HelloResponse) GetMessage ¶
func (x *HelloResponse) GetMessage() 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 HelloServer ¶
type HelloServer interface { SayHello(context.Context, *HelloRequest) (*HelloResponse, error) // 增加一个支持双向流的方法 Channel(Hello_ChannelServer) error }
HelloServer is the server API for Hello service.
type Hello_ChannelClient ¶
type Hello_ChannelClient interface { Send(*StreamRequest) error Recv() (*StreamResponse, error) grpc.ClientStream }
type Hello_ChannelServer ¶
type Hello_ChannelServer interface { Send(*StreamResponse) error Recv() (*StreamRequest, error) grpc.ServerStream }
type StreamRequest ¶
type StreamRequest struct { Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*StreamRequest) Descriptor
deprecated
func (*StreamRequest) Descriptor() ([]byte, []int)
Deprecated: Use StreamRequest.ProtoReflect.Descriptor instead.
func (*StreamRequest) GetData ¶
func (x *StreamRequest) GetData() string
func (*StreamRequest) ProtoMessage ¶
func (*StreamRequest) ProtoMessage()
func (*StreamRequest) ProtoReflect ¶
func (x *StreamRequest) ProtoReflect() protoreflect.Message
func (*StreamRequest) Reset ¶
func (x *StreamRequest) Reset()
func (*StreamRequest) String ¶
func (x *StreamRequest) String() string
type StreamResponse ¶
type StreamResponse struct { Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*StreamResponse) Descriptor
deprecated
func (*StreamResponse) Descriptor() ([]byte, []int)
Deprecated: Use StreamResponse.ProtoReflect.Descriptor instead.
func (*StreamResponse) GetData ¶
func (x *StreamResponse) GetData() string
func (*StreamResponse) ProtoMessage ¶
func (*StreamResponse) ProtoMessage()
func (*StreamResponse) ProtoReflect ¶
func (x *StreamResponse) ProtoReflect() protoreflect.Message
func (*StreamResponse) Reset ¶
func (x *StreamResponse) Reset()
func (*StreamResponse) String ¶
func (x *StreamResponse) String() string
type UnimplementedHelloServer ¶
type UnimplementedHelloServer struct { }
UnimplementedHelloServer can be embedded to have forward compatible implementations.
func (*UnimplementedHelloServer) Channel ¶
func (*UnimplementedHelloServer) Channel(Hello_ChannelServer) error
func (*UnimplementedHelloServer) SayHello ¶
func (*UnimplementedHelloServer) SayHello(context.Context, *HelloRequest) (*HelloResponse, error)
Click to show internal directories.
Click to hide internal directories.