user

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package user is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterUserHandler

func RegisterUserHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterUserHandler registers the http handlers for service User to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterUserHandlerClient

func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserClient) error

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

func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServer) error

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

func (*InfoReq) GetCode

func (m *InfoReq) GetCode() string

func (*InfoReq) ProtoMessage

func (*InfoReq) ProtoMessage()

func (*InfoReq) Reset

func (m *InfoReq) Reset()

func (*InfoReq) String

func (m *InfoReq) String() string

func (*InfoReq) Validate

func (this *InfoReq) Validate() error

func (*InfoReq) XXX_DiscardUnknown

func (m *InfoReq) XXX_DiscardUnknown()

func (*InfoReq) XXX_Marshal

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

func (*InfoReq) XXX_Merge

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

func (*InfoReq) XXX_Size

func (m *InfoReq) XXX_Size() int

func (*InfoReq) XXX_Unmarshal

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

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

func (*InfoResp) GetCode

func (m *InfoResp) GetCode() string

func (*InfoResp) GetName

func (m *InfoResp) GetName() string

func (*InfoResp) ProtoMessage

func (*InfoResp) ProtoMessage()

func (*InfoResp) Reset

func (m *InfoResp) Reset()

func (*InfoResp) String

func (m *InfoResp) String() string

func (*InfoResp) Validate

func (this *InfoResp) Validate() error

func (*InfoResp) XXX_DiscardUnknown

func (m *InfoResp) XXX_DiscardUnknown()

func (*InfoResp) XXX_Marshal

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

func (*InfoResp) XXX_Merge

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

func (*InfoResp) XXX_Size

func (m *InfoResp) XXX_Size() int

func (*InfoResp) XXX_Unmarshal

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

type UnimplementedUserServer

type UnimplementedUserServer struct {
}

UnimplementedUserServer can be embedded to have forward compatible implementations.

func (*UnimplementedUserServer) Info

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

type UserServer

type UserServer interface {
	// 详情
	Info(context.Context, *InfoReq) (*InfoResp, error)
}

UserServer is the server API for User service.

Jump to

Keyboard shortcuts

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