pb

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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) Descriptor() ([]byte, []int)

Deprecated: Use LoginReq.ProtoReflect.Descriptor instead.

func (*LoginReq) GetPassword

func (x *LoginReq) GetPassword() string

func (*LoginReq) GetUsername

func (x *LoginReq) GetUsername() string

func (*LoginReq) ProtoMessage

func (*LoginReq) ProtoMessage()

func (*LoginReq) ProtoReflect

func (x *LoginReq) ProtoReflect() protoreflect.Message

func (*LoginReq) Reset

func (x *LoginReq) Reset()

func (*LoginReq) String

func (x *LoginReq) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use LoginResp.ProtoReflect.Descriptor instead.

func (*LoginResp) GetCode

func (x *LoginResp) GetCode() int32

func (*LoginResp) GetMsg

func (x *LoginResp) GetMsg() string

func (*LoginResp) ProtoMessage

func (*LoginResp) ProtoMessage()

func (*LoginResp) ProtoReflect

func (x *LoginResp) ProtoReflect() protoreflect.Message

func (*LoginResp) Reset

func (x *LoginResp) Reset()

func (*LoginResp) String

func (x *LoginResp) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Person.ProtoReflect.Descriptor instead.

func (*Person) GetAge

func (x *Person) GetAge() int32

func (*Person) GetEmails

func (x *Person) GetEmails() []string

func (*Person) GetName

func (x *Person) GetName() string

func (*Person) GetPhones

func (x *Person) GetPhones() []*PhoneNumber

func (*Person) ProtoMessage

func (*Person) ProtoMessage()

func (*Person) ProtoReflect

func (x *Person) ProtoReflect() protoreflect.Message

func (*Person) Reset

func (x *Person) Reset()

func (*Person) String

func (x *Person) String() string

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为关键字,作用为定义一种枚举类型

const (
	PhoneType_MOBILE PhoneType = 0
	PhoneType_HOME   PhoneType = 1
	PhoneType_WORK   PhoneType = 2
)

func (PhoneType) Descriptor

func (PhoneType) Descriptor() protoreflect.EnumDescriptor

func (PhoneType) Enum

func (x PhoneType) Enum() *PhoneType

func (PhoneType) EnumDescriptor deprecated

func (PhoneType) EnumDescriptor() ([]byte, []int)

Deprecated: Use PhoneType.Descriptor instead.

func (PhoneType) Number

func (x PhoneType) Number() protoreflect.EnumNumber

func (PhoneType) String

func (x PhoneType) String() string

func (PhoneType) Type

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedUserServiceServer) Login

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.

type UserServiceServer

type UserServiceServer interface {
	Login(context.Context, *LoginReq) (*LoginResp, error)
}

UserServiceServer is the server API for UserService service.

Jump to

Keyboard shortcuts

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