pb

package
v0.0.0-...-88ed1f5 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: MIT Imports: 19 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

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

func AssetDir(name string) ([]string, error)

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

func AssetInfo(name string) (os.FileInfo, error)

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 AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

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

func RestoreAsset(dir, name string) error

Restore an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

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

func (*UserResp) GetAge

func (m *UserResp) GetAge() int64

func (*UserResp) GetFortune

func (m *UserResp) GetFortune() string

func (*UserResp) GetId

func (m *UserResp) GetId() int64

func (*UserResp) GetName

func (m *UserResp) GetName() string

func (*UserResp) ProtoMessage

func (*UserResp) ProtoMessage()

func (*UserResp) Reset

func (m *UserResp) Reset()

func (*UserResp) String

func (m *UserResp) String() string

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

func (*UsersResp) GetUsers

func (m *UsersResp) GetUsers() []*UserResp

func (*UsersResp) ProtoMessage

func (*UsersResp) ProtoMessage()

func (*UsersResp) Reset

func (m *UsersResp) Reset()

func (*UsersResp) String

func (m *UsersResp) String() string

Jump to

Keyboard shortcuts

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