Documentation ¶
Index ¶
- Variables
- func RegisterHelloServiceServer(s grpc.ServiceRegistrar, srv HelloServiceServer)
- func RegisterPubsubServiceServer(s grpc.ServiceRegistrar, srv PubsubServiceServer)
- type HelloServiceClient
- type HelloServiceServer
- type HelloService_ChannelClient
- type HelloService_ChannelServer
- type Message
- type PubsubServiceClient
- type PubsubServiceServer
- type PubsubService_SubscribeClient
- type PubsubService_SubscribeServer
- type String
- type UnimplementedHelloServiceServer
- type UnimplementedPubsubServiceServer
- type UnsafeHelloServiceServer
- type UnsafePubsubServiceServer
Constants ¶
This section is empty.
Variables ¶
var ( // những con số như: 50000, 50001 là duy nhất cho mỗi trường // // optional string default_string = 50000; E_DefaultString = &file_hello_proto_extTypes[0] // optional int32 default_int = 50001; E_DefaultInt = &file_hello_proto_extTypes[1] )
Extension fields to descriptorpb.FieldOptions.
var File_hello_proto protoreflect.FileDescriptor
var HelloService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "model.HelloService", HandlerType: (*HelloServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Hello", Handler: _HelloService_Hello_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Channel", Handler: _HelloService_Channel_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "hello.proto", }
HelloService_ServiceDesc is the grpc.ServiceDesc for HelloService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var PubsubService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "model.PubsubService", HandlerType: (*PubsubServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Publish", Handler: _PubsubService_Publish_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Subscribe", Handler: _PubsubService_Subscribe_Handler, ServerStreams: true, }, }, Metadata: "hello.proto", }
PubsubService_ServiceDesc is the grpc.ServiceDesc for PubsubService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterHelloServiceServer ¶
func RegisterHelloServiceServer(s grpc.ServiceRegistrar, srv HelloServiceServer)
func RegisterPubsubServiceServer ¶
func RegisterPubsubServiceServer(s grpc.ServiceRegistrar, srv PubsubServiceServer)
Types ¶
type HelloServiceClient ¶
type HelloServiceClient interface { // định nghĩa lời gọi hàm RPC Hello(ctx context.Context, in *String, opts ...grpc.CallOption) (*String, error) // nhận vào tham số một stream và trả về giá trị là một stream. Channel(ctx context.Context, opts ...grpc.CallOption) (HelloService_ChannelClient, error) }
HelloServiceClient is the client API for HelloService 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 NewHelloServiceClient ¶
func NewHelloServiceClient(cc grpc.ClientConnInterface) HelloServiceClient
type HelloServiceServer ¶
type HelloServiceServer interface { // định nghĩa lời gọi hàm RPC Hello(context.Context, *String) (*String, error) // nhận vào tham số một stream và trả về giá trị là một stream. Channel(HelloService_ChannelServer) error }
HelloServiceServer is the server API for HelloService service. All implementations should embed UnimplementedHelloServiceServer for forward compatibility
type Message ¶
type Message struct { // default_string là giá trị mặc định cho name Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // tương tự, age sẽ có giá trị 10 nếu không khởi trị Age int32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"` // contains filtered or unexported fields }
định nghĩa nội dung message
func (*Message) Descriptor
deprecated
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶
func (x *Message) ProtoReflect() protoreflect.Message
type PubsubServiceClient ¶
type PubsubServiceClient interface { // phương thức RPC thông thường Publish(ctx context.Context, in *String, opts ...grpc.CallOption) (*String, error) // service server streaming Subscribe(ctx context.Context, in *String, opts ...grpc.CallOption) (PubsubService_SubscribeClient, error) }
PubsubServiceClient is the client API for PubsubService 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 NewPubsubServiceClient ¶
func NewPubsubServiceClient(cc grpc.ClientConnInterface) PubsubServiceClient
type PubsubServiceServer ¶
type PubsubServiceServer interface { // phương thức RPC thông thường Publish(context.Context, *String) (*String, error) // service server streaming Subscribe(*String, PubsubService_SubscribeServer) error }
PubsubServiceServer is the server API for PubsubService service. All implementations should embed UnimplementedPubsubServiceServer for forward compatibility
type PubsubService_SubscribeClient ¶
type PubsubService_SubscribeClient interface { Recv() (*String, error) grpc.ClientStream }
type PubsubService_SubscribeServer ¶
type PubsubService_SubscribeServer interface { Send(*String) error grpc.ServerStream }
type String ¶
type String struct { // chuỗi string được truyền vào hàm RPC Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
message là một đơn vị dữ liệu trong Protobuf
func (*String) Descriptor
deprecated
func (*String) ProtoMessage ¶
func (*String) ProtoMessage()
func (*String) ProtoReflect ¶
func (x *String) ProtoReflect() protoreflect.Message
type UnimplementedHelloServiceServer ¶
type UnimplementedHelloServiceServer struct { }
UnimplementedHelloServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedHelloServiceServer) Channel ¶
func (UnimplementedHelloServiceServer) Channel(HelloService_ChannelServer) error
type UnimplementedPubsubServiceServer ¶
type UnimplementedPubsubServiceServer struct { }
UnimplementedPubsubServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedPubsubServiceServer) Subscribe ¶
func (UnimplementedPubsubServiceServer) Subscribe(*String, PubsubService_SubscribeServer) error
type UnsafeHelloServiceServer ¶
type UnsafeHelloServiceServer interface {
// contains filtered or unexported methods
}
UnsafeHelloServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HelloServiceServer will result in compilation errors.
type UnsafePubsubServiceServer ¶
type UnsafePubsubServiceServer interface {
// contains filtered or unexported methods
}
UnsafePubsubServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PubsubServiceServer will result in compilation errors.