Documentation ¶
Overview ¶
Package user is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- func RegisterUserHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserClient) error
- func RegisterUserHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServer) error
- func RegisterUserServer(s *grpc.Server, srv UserServer)
- type InfoReq
- func (*InfoReq) Descriptor() ([]byte, []int)
- func (m *InfoReq) GetCode() string
- func (*InfoReq) ProtoMessage()
- func (m *InfoReq) Reset()
- func (m *InfoReq) String() string
- func (this *InfoReq) Validate() error
- func (m *InfoReq) XXX_DiscardUnknown()
- func (m *InfoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *InfoReq) XXX_Merge(src proto.Message)
- func (m *InfoReq) XXX_Size() int
- func (m *InfoReq) XXX_Unmarshal(b []byte) error
- type InfoResp
- func (*InfoResp) Descriptor() ([]byte, []int)
- func (m *InfoResp) GetCode() string
- func (m *InfoResp) GetName() string
- func (*InfoResp) ProtoMessage()
- func (m *InfoResp) Reset()
- func (m *InfoResp) String() string
- func (this *InfoResp) Validate() error
- func (m *InfoResp) XXX_DiscardUnknown()
- func (m *InfoResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *InfoResp) XXX_Merge(src proto.Message)
- func (m *InfoResp) XXX_Size() int
- func (m *InfoResp) XXX_Unmarshal(b []byte) error
- type UnimplementedUserServer
- type UserClient
- type UserServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterUserHandler ¶
RegisterUserHandler registers the http handlers for service User to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserHandlerClient ¶
RegisterUserHandlerClient registers the http handlers for service User to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserClient" to call the correct interceptors.
func RegisterUserHandlerFromEndpoint ¶
func RegisterUserHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserHandlerFromEndpoint is same as RegisterUserHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserHandlerServer ¶
RegisterUserHandlerServer registers the http handlers for service User to "mux". UnaryRPC :call UserServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserHandlerFromEndpoint instead.
func RegisterUserServer ¶
func RegisterUserServer(s *grpc.Server, srv UserServer)
Types ¶
type InfoReq ¶
type InfoReq struct { // 编码 Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
详情 请求
func (*InfoReq) Descriptor ¶
func (*InfoReq) ProtoMessage ¶
func (*InfoReq) ProtoMessage()
func (*InfoReq) XXX_DiscardUnknown ¶
func (m *InfoReq) XXX_DiscardUnknown()
func (*InfoReq) XXX_Marshal ¶
func (*InfoReq) XXX_Unmarshal ¶
type InfoResp ¶
type InfoResp struct { // 编码 Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` // 名称 Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
详情 返回值
func (*InfoResp) Descriptor ¶
func (*InfoResp) ProtoMessage ¶
func (*InfoResp) ProtoMessage()
func (*InfoResp) XXX_DiscardUnknown ¶
func (m *InfoResp) XXX_DiscardUnknown()
func (*InfoResp) XXX_Marshal ¶
func (*InfoResp) XXX_Unmarshal ¶
type UnimplementedUserServer ¶
type UnimplementedUserServer struct { }
UnimplementedUserServer can be embedded to have forward compatible implementations.
type UserClient ¶
type UserClient interface { // 详情 Info(ctx context.Context, in *InfoReq, opts ...grpc.CallOption) (*InfoResp, error) }
UserClient is the client API for User service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewUserClient ¶
func NewUserClient(cc *grpc.ClientConn) UserClient