Documentation ¶
Index ¶
- Variables
- func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)
- type LoginReq
- type LoginResp
- type Person
- func (*Person) Descriptor() ([]byte, []int)deprecated
- func (x *Person) GetAge() int32
- func (x *Person) GetEmails() []string
- func (x *Person) GetName() string
- func (x *Person) GetPhones() []*PhoneNumber
- func (*Person) ProtoMessage()
- func (x *Person) ProtoReflect() protoreflect.Message
- func (x *Person) Reset()
- func (x *Person) String() string
- type PhoneNumber
- func (*PhoneNumber) Descriptor() ([]byte, []int)deprecated
- func (x *PhoneNumber) GetNumber() string
- func (x *PhoneNumber) GetType() PhoneType
- func (*PhoneNumber) ProtoMessage()
- func (x *PhoneNumber) ProtoReflect() protoreflect.Message
- func (x *PhoneNumber) Reset()
- func (x *PhoneNumber) String() string
- type PhoneType
- type UnimplementedUserServiceServer
- type UserServiceClient
- type UserServiceServer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PhoneType_name = map[int32]string{ 0: "MOBILE", 1: "HOME", 2: "WORK", } PhoneType_value = map[string]int32{ "MOBILE": 0, "HOME": 1, "WORK": 2, } )
Enum value maps for PhoneType.
View Source
var File_hgrpc_proto protoreflect.FileDescriptor
Functions ¶
func RegisterUserServiceServer ¶
func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)
Types ¶
type LoginReq ¶
type LoginReq struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
func (*LoginReq) Descriptor
deprecated
func (*LoginReq) GetPassword ¶
func (*LoginReq) GetUsername ¶
func (*LoginReq) ProtoMessage ¶
func (*LoginReq) ProtoMessage()
func (*LoginReq) ProtoReflect ¶
func (x *LoginReq) ProtoReflect() protoreflect.Message
type LoginResp ¶
type LoginResp struct { Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` // contains filtered or unexported fields }
func (*LoginResp) Descriptor
deprecated
func (*LoginResp) ProtoMessage ¶
func (*LoginResp) ProtoMessage()
func (*LoginResp) ProtoReflect ¶
func (x *LoginResp) ProtoReflect() protoreflect.Message
type Person ¶
type Person struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // 姓名 Age int32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"` // 年龄 Emails []string `protobuf:"bytes,3,rep,name=emails,proto3" json:"emails,omitempty"` // 电子邮件(repeated表示字段允许重复) Phones []*PhoneNumber `protobuf:"bytes,4,rep,name=phones,proto3" json:"phones,omitempty"` // 手机号 // contains filtered or unexported fields }
message为关键字,作用为定义一种消息类型
func (*Person) Descriptor
deprecated
func (*Person) GetPhones ¶
func (x *Person) GetPhones() []*PhoneNumber
func (*Person) ProtoMessage ¶
func (*Person) ProtoMessage()
func (*Person) ProtoReflect ¶
func (x *Person) ProtoReflect() protoreflect.Message
type PhoneNumber ¶
type PhoneNumber struct { Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"` Type PhoneType `protobuf:"varint,2,opt,name=type,proto3,enum=pb.PhoneType" json:"type,omitempty"` // contains filtered or unexported fields }
message为关键字,作用为定义一种消息类型可以被另外的消息类型嵌套使用
func (*PhoneNumber) Descriptor
deprecated
func (*PhoneNumber) Descriptor() ([]byte, []int)
Deprecated: Use PhoneNumber.ProtoReflect.Descriptor instead.
func (*PhoneNumber) GetNumber ¶
func (x *PhoneNumber) GetNumber() string
func (*PhoneNumber) GetType ¶
func (x *PhoneNumber) GetType() PhoneType
func (*PhoneNumber) ProtoMessage ¶
func (*PhoneNumber) ProtoMessage()
func (*PhoneNumber) ProtoReflect ¶
func (x *PhoneNumber) ProtoReflect() protoreflect.Message
func (*PhoneNumber) Reset ¶
func (x *PhoneNumber) Reset()
func (*PhoneNumber) String ¶
func (x *PhoneNumber) String() string
type PhoneType ¶
type PhoneType int32
enum为关键字,作用为定义一种枚举类型
func (PhoneType) Descriptor ¶
func (PhoneType) Descriptor() protoreflect.EnumDescriptor
func (PhoneType) EnumDescriptor
deprecated
func (PhoneType) Number ¶
func (x PhoneType) Number() protoreflect.EnumNumber
func (PhoneType) Type ¶
func (PhoneType) Type() protoreflect.EnumType
type UnimplementedUserServiceServer ¶
type UnimplementedUserServiceServer struct { }
UnimplementedUserServiceServer can be embedded to have forward compatible implementations.
type UserServiceClient ¶
type UserServiceClient interface {
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error)
}
UserServiceClient is the client API for UserService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewUserServiceClient ¶
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient
Click to show internal directories.
Click to hide internal directories.