grpc_simple

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL