protobuf

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Person_PhoneType_name = map[int32]string{
	0: "MOBILE",
	1: "HOME",
	2: "WORK",
}
View Source
var Person_PhoneType_value = map[string]int32{
	"MOBILE": 0,
	"HOME":   1,
	"WORK":   2,
}

Functions

func RegisterGreeterServer

func RegisterGreeterServer(s *grpc.Server, srv GreeterServer)

Types

type AddressBook

type AddressBook struct {
	People               []*Person `protobuf:"bytes,1,rep,name=people,proto3" json:"people,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

Our address book file is just one of these.

func (*AddressBook) Descriptor

func (*AddressBook) Descriptor() ([]byte, []int)

func (*AddressBook) GetPeople

func (m *AddressBook) GetPeople() []*Person

func (*AddressBook) ProtoMessage

func (*AddressBook) ProtoMessage()

func (*AddressBook) Reset

func (m *AddressBook) Reset()

func (*AddressBook) String

func (m *AddressBook) String() string

func (*AddressBook) XXX_DiscardUnknown

func (m *AddressBook) XXX_DiscardUnknown()

func (*AddressBook) XXX_Marshal

func (m *AddressBook) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AddressBook) XXX_Merge

func (m *AddressBook) XXX_Merge(src proto.Message)

func (*AddressBook) XXX_Size

func (m *AddressBook) XXX_Size() int

func (*AddressBook) XXX_Unmarshal

func (m *AddressBook) XXX_Unmarshal(b []byte) error

type GreeterClient

type GreeterClient interface {
	// 服务端返馈信息方法
	SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
}

GreeterClient is the client API for Greeter service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewGreeterClient

func NewGreeterClient(cc *grpc.ClientConn) GreeterClient

type GreeterServer

type GreeterServer interface {
	// 服务端返馈信息方法
	SayHello(context.Context, *HelloRequest) (*HelloReply, error)
}

GreeterServer is the server API for Greeter service.

type HelloReply

type HelloReply struct {
	Message              string   `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

服务端响应信息

func (*HelloReply) Descriptor

func (*HelloReply) Descriptor() ([]byte, []int)

func (*HelloReply) GetMessage

func (m *HelloReply) GetMessage() string

func (*HelloReply) ProtoMessage

func (*HelloReply) ProtoMessage()

func (*HelloReply) Reset

func (m *HelloReply) Reset()

func (*HelloReply) String

func (m *HelloReply) String() string

func (*HelloReply) XXX_DiscardUnknown

func (m *HelloReply) XXX_DiscardUnknown()

func (*HelloReply) XXX_Marshal

func (m *HelloReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HelloReply) XXX_Merge

func (m *HelloReply) XXX_Merge(src proto.Message)

func (*HelloReply) XXX_Size

func (m *HelloReply) XXX_Size() int

func (*HelloReply) XXX_Unmarshal

func (m *HelloReply) XXX_Unmarshal(b []byte) error

type HelloRequest

type HelloRequest struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

包含用户名的请求信息

func (*HelloRequest) Descriptor

func (*HelloRequest) Descriptor() ([]byte, []int)

func (*HelloRequest) GetName

func (m *HelloRequest) GetName() string

func (*HelloRequest) ProtoMessage

func (*HelloRequest) ProtoMessage()

func (*HelloRequest) Reset

func (m *HelloRequest) Reset()

func (*HelloRequest) String

func (m *HelloRequest) String() string

func (*HelloRequest) XXX_DiscardUnknown

func (m *HelloRequest) XXX_DiscardUnknown()

func (*HelloRequest) XXX_Marshal

func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HelloRequest) XXX_Merge

func (m *HelloRequest) XXX_Merge(src proto.Message)

func (*HelloRequest) XXX_Size

func (m *HelloRequest) XXX_Size() int

func (*HelloRequest) XXX_Unmarshal

func (m *HelloRequest) XXX_Unmarshal(b []byte) error

type Person

type Person struct {
	Name                 string                `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Id                   int32                 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	Email                string                `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	Phones               []*Person_PhoneNumber `protobuf:"bytes,4,rep,name=phones,proto3" json:"phones,omitempty"`
	LastUpdated          *timestamp.Timestamp  `protobuf:"bytes,5,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"`
	XXX_NoUnkeyedLiteral struct{}              `json:"-"`
	XXX_unrecognized     []byte                `json:"-"`
	XXX_sizecache        int32                 `json:"-"`
}

func (*Person) Descriptor

func (*Person) Descriptor() ([]byte, []int)

func (*Person) GetEmail

func (m *Person) GetEmail() string

func (*Person) GetId

func (m *Person) GetId() int32

func (*Person) GetLastUpdated

func (m *Person) GetLastUpdated() *timestamp.Timestamp

func (*Person) GetName

func (m *Person) GetName() string

func (*Person) GetPhones

func (m *Person) GetPhones() []*Person_PhoneNumber

func (*Person) ProtoMessage

func (*Person) ProtoMessage()

func (*Person) Reset

func (m *Person) Reset()

func (*Person) String

func (m *Person) String() string

func (*Person) XXX_DiscardUnknown

func (m *Person) XXX_DiscardUnknown()

func (*Person) XXX_Marshal

func (m *Person) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Person) XXX_Merge

func (m *Person) XXX_Merge(src proto.Message)

func (*Person) XXX_Size

func (m *Person) XXX_Size() int

func (*Person) XXX_Unmarshal

func (m *Person) XXX_Unmarshal(b []byte) error

type Person_PhoneNumber

type Person_PhoneNumber struct {
	Number               string           `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"`
	Type                 Person_PhoneType `protobuf:"varint,2,opt,name=type,proto3,enum=protobuf.Person_PhoneType" json:"type,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func (*Person_PhoneNumber) Descriptor

func (*Person_PhoneNumber) Descriptor() ([]byte, []int)

func (*Person_PhoneNumber) GetNumber

func (m *Person_PhoneNumber) GetNumber() string

func (*Person_PhoneNumber) GetType

func (m *Person_PhoneNumber) GetType() Person_PhoneType

func (*Person_PhoneNumber) ProtoMessage

func (*Person_PhoneNumber) ProtoMessage()

func (*Person_PhoneNumber) Reset

func (m *Person_PhoneNumber) Reset()

func (*Person_PhoneNumber) String

func (m *Person_PhoneNumber) String() string

func (*Person_PhoneNumber) XXX_DiscardUnknown

func (m *Person_PhoneNumber) XXX_DiscardUnknown()

func (*Person_PhoneNumber) XXX_Marshal

func (m *Person_PhoneNumber) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Person_PhoneNumber) XXX_Merge

func (m *Person_PhoneNumber) XXX_Merge(src proto.Message)

func (*Person_PhoneNumber) XXX_Size

func (m *Person_PhoneNumber) XXX_Size() int

func (*Person_PhoneNumber) XXX_Unmarshal

func (m *Person_PhoneNumber) XXX_Unmarshal(b []byte) error

type Person_PhoneType

type Person_PhoneType int32
const (
	Person_MOBILE Person_PhoneType = 0
	Person_HOME   Person_PhoneType = 1
	Person_WORK   Person_PhoneType = 2
)

func (Person_PhoneType) EnumDescriptor

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

func (Person_PhoneType) String

func (x Person_PhoneType) String() string

type UnimplementedGreeterServer

type UnimplementedGreeterServer struct {
}

UnimplementedGreeterServer can be embedded to have forward compatible implementations.

func (*UnimplementedGreeterServer) SayHello

Jump to

Keyboard shortcuts

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