Documentation ¶
Index ¶
- func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)
- type UserRequest
- func (*UserRequest) Descriptor() ([]byte, []int)
- func (m *UserRequest) GetID() int32
- func (*UserRequest) ProtoMessage()
- func (m *UserRequest) Reset()
- func (m *UserRequest) String() string
- func (m *UserRequest) XXX_DiscardUnknown()
- func (m *UserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *UserRequest) XXX_Merge(src proto.Message)
- func (m *UserRequest) XXX_Size() int
- func (m *UserRequest) XXX_Unmarshal(b []byte) error
- type UserResponse
- func (*UserResponse) Descriptor() ([]byte, []int)
- func (m *UserResponse) GetAge() int32
- func (m *UserResponse) GetName() string
- func (*UserResponse) ProtoMessage()
- func (m *UserResponse) Reset()
- func (m *UserResponse) String() string
- func (m *UserResponse) XXX_DiscardUnknown()
- func (m *UserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *UserResponse) XXX_Merge(src proto.Message)
- func (m *UserResponse) XXX_Size() int
- func (m *UserResponse) XXX_Unmarshal(b []byte) error
- type UserServiceClient
- type UserServiceServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterUserServiceServer ¶
func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)
Types ¶
type UserRequest ¶
type UserRequest struct { ID int32 `protobuf:"varint,1,opt,name=ID" json:"ID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
客户端请求的格式
func (*UserRequest) Descriptor ¶
func (*UserRequest) Descriptor() ([]byte, []int)
func (*UserRequest) GetID ¶
func (m *UserRequest) GetID() int32
func (*UserRequest) ProtoMessage ¶
func (*UserRequest) ProtoMessage()
func (*UserRequest) Reset ¶
func (m *UserRequest) Reset()
func (*UserRequest) String ¶
func (m *UserRequest) String() string
func (*UserRequest) XXX_DiscardUnknown ¶
func (m *UserRequest) XXX_DiscardUnknown()
func (*UserRequest) XXX_Marshal ¶
func (m *UserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UserRequest) XXX_Merge ¶
func (dst *UserRequest) XXX_Merge(src proto.Message)
func (*UserRequest) XXX_Size ¶
func (m *UserRequest) XXX_Size() int
func (*UserRequest) XXX_Unmarshal ¶
func (m *UserRequest) XXX_Unmarshal(b []byte) error
type UserResponse ¶
type UserResponse struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Age int32 `protobuf:"varint,2,opt,name=age" json:"age,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
服务端响应的格式
func (*UserResponse) Descriptor ¶
func (*UserResponse) Descriptor() ([]byte, []int)
func (*UserResponse) GetAge ¶
func (m *UserResponse) GetAge() int32
func (*UserResponse) GetName ¶
func (m *UserResponse) GetName() string
func (*UserResponse) ProtoMessage ¶
func (*UserResponse) ProtoMessage()
func (*UserResponse) Reset ¶
func (m *UserResponse) Reset()
func (*UserResponse) String ¶
func (m *UserResponse) String() string
func (*UserResponse) XXX_DiscardUnknown ¶
func (m *UserResponse) XXX_DiscardUnknown()
func (*UserResponse) XXX_Marshal ¶
func (m *UserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UserResponse) XXX_Merge ¶
func (dst *UserResponse) XXX_Merge(src proto.Message)
func (*UserResponse) XXX_Size ¶
func (m *UserResponse) XXX_Size() int
func (*UserResponse) XXX_Unmarshal ¶
func (m *UserResponse) XXX_Unmarshal(b []byte) error
type UserServiceClient ¶
type UserServiceClient interface { // 微服务中获取用户信息的 RPC 函数 // 通过 ID 获取用户详细信息 name、age GetUserInfo(ctx context.Context, in *UserRequest, opts ...grpc.CallOption) (*UserResponse, error) }
func NewUserServiceClient ¶
func NewUserServiceClient(cc *grpc.ClientConn) UserServiceClient
type UserServiceServer ¶
type UserServiceServer interface { // 微服务中获取用户信息的 RPC 函数 // 通过 ID 获取用户详细信息 name、age GetUserInfo(context.Context, *UserRequest) (*UserResponse, error) }
Click to show internal directories.
Click to hide internal directories.