Documentation ¶
Overview ¶
Package pb is a generated protocol buffer package.
User Service ¶
User Service API provides create, read, and read (many) access to a list of users.
It is generated from these files:
grpcbasic0.proto
It has these top-level messages:
UserResp NewUserReq GetUserReq UsersResp GetUsersReq
Package pb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error
- func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type GetUserReq
- type GetUsersReq
- type NewUserReq
- type UserResp
- type UserServiceClient
- type UserServiceServer
- type UsersResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RegisterUserServiceHandler ¶
func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterUserServiceHandler registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserServiceHandlerClient ¶
func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error
RegisterUserServiceHandlerClient registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserServiceClient" to call the correct interceptors.
func RegisterUserServiceHandlerFromEndpoint ¶
func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserServiceHandlerFromEndpoint is same as RegisterUserServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserServiceServer ¶
func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)
func RestoreAsset ¶
Restore an asset under the given directory
func RestoreAssets ¶
Restore assets under the given directory recursively
Types ¶
type GetUserReq ¶
type GetUserReq struct {
Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
}
func (*GetUserReq) Descriptor ¶
func (*GetUserReq) Descriptor() ([]byte, []int)
func (*GetUserReq) GetId ¶
func (m *GetUserReq) GetId() int64
func (*GetUserReq) ProtoMessage ¶
func (*GetUserReq) ProtoMessage()
func (*GetUserReq) Reset ¶
func (m *GetUserReq) Reset()
func (*GetUserReq) String ¶
func (m *GetUserReq) String() string
type GetUsersReq ¶
type GetUsersReq struct { Start int64 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` Count int64 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` Desc bool `protobuf:"varint,3,opt,name=desc" json:"desc,omitempty"` }
func (*GetUsersReq) Descriptor ¶
func (*GetUsersReq) Descriptor() ([]byte, []int)
func (*GetUsersReq) GetCount ¶
func (m *GetUsersReq) GetCount() int64
func (*GetUsersReq) GetDesc ¶
func (m *GetUsersReq) GetDesc() bool
func (*GetUsersReq) GetStart ¶
func (m *GetUsersReq) GetStart() int64
func (*GetUsersReq) ProtoMessage ¶
func (*GetUsersReq) ProtoMessage()
func (*GetUsersReq) Reset ¶
func (m *GetUsersReq) Reset()
func (*GetUsersReq) String ¶
func (m *GetUsersReq) String() string
type NewUserReq ¶
type NewUserReq struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Age int64 `protobuf:"varint,2,opt,name=age" json:"age,omitempty"` }
func (*NewUserReq) Descriptor ¶
func (*NewUserReq) Descriptor() ([]byte, []int)
func (*NewUserReq) GetAge ¶
func (m *NewUserReq) GetAge() int64
func (*NewUserReq) GetName ¶
func (m *NewUserReq) GetName() string
func (*NewUserReq) ProtoMessage ¶
func (*NewUserReq) ProtoMessage()
func (*NewUserReq) Reset ¶
func (m *NewUserReq) Reset()
func (*NewUserReq) String ¶
func (m *NewUserReq) String() string
type UserResp ¶
type UserResp struct { Id int64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` Age int64 `protobuf:"varint,3,opt,name=age" json:"age,omitempty"` Fortune string `protobuf:"bytes,4,opt,name=fortune" json:"fortune,omitempty"` }
func (*UserResp) Descriptor ¶
func (*UserResp) GetFortune ¶
func (*UserResp) ProtoMessage ¶
func (*UserResp) ProtoMessage()
type UserServiceClient ¶
type UserServiceClient interface { NewUser(ctx context.Context, in *NewUserReq, opts ...grpc.CallOption) (*UserResp, error) GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*UserResp, error) GetUsers(ctx context.Context, in *GetUsersReq, opts ...grpc.CallOption) (*UsersResp, error) }
func NewUserServiceClient ¶
func NewUserServiceClient(cc *grpc.ClientConn) UserServiceClient
type UserServiceServer ¶
type UserServiceServer interface { NewUser(context.Context, *NewUserReq) (*UserResp, error) GetUser(context.Context, *GetUserReq) (*UserResp, error) GetUsers(context.Context, *GetUsersReq) (*UsersResp, error) }
type UsersResp ¶
type UsersResp struct {
Users []*UserResp `protobuf:"bytes,1,rep,name=users" json:"users,omitempty"`
}
func (*UsersResp) Descriptor ¶
func (*UsersResp) ProtoMessage ¶
func (*UsersResp) ProtoMessage()