Documentation ¶
Index ¶
- Variables
- func FetchUserInfo(ctx context.Context) (*auth.CustomClaims, error)
- func GetHeader(ctx context.Context) map[string][]string
- func GetHeaderKey(ctx context.Context, key string) string
- func Marshal(out *Response, data interface{})
- func RegisterRpcServiceServer(s *grpc.Server, srv RpcServiceServer)
- func Unmarshal(in *Request, data interface{}) error
- type Args
- func (*Args) Descriptor() ([]byte, []int)
- func (m *Args) GetArgs() []byte
- func (m *Args) GetMethod() string
- func (m *Args) GetService() string
- func (m *Args) GetVersion() string
- func (*Args) ProtoMessage()
- func (m *Args) Reset()
- func (m *Args) String() string
- func (m *Args) XXX_DiscardUnknown()
- func (m *Args) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Args) XXX_Merge(src proto.Message)
- func (m *Args) XXX_Size() int
- func (m *Args) XXX_Unmarshal(b []byte) error
- type GrpcClient
- func (c *GrpcClient) Close() error
- func (c *GrpcClient) GetConn() *grpc.ClientConn
- func (c *GrpcClient) Invoke(in *Request, ip string, userInfo *auth.CustomClaims, opts ...grpc.CallOption) (*Response, error)
- func (c *GrpcClient) InvokeWithTimeout(in *Request, ip string, userInfo *auth.CustomClaims, timeout time.Duration, ...) (*Response, error)
- func (c *GrpcClient) NoAuth() bool
- type Request
- func (*Request) Descriptor() ([]byte, []int)
- func (m *Request) GetRequestJson() []byte
- func (*Request) ProtoMessage()
- func (m *Request) Reset()
- func (m *Request) String() string
- func (m *Request) XXX_DiscardUnknown()
- func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Request) XXX_Merge(src proto.Message)
- func (m *Request) XXX_Size() int
- func (m *Request) XXX_Unmarshal(b []byte) error
- type Response
- func (m *Response) Build(code int32, msg interface{}, data ...interface{}) *Response
- func (*Response) Descriptor() ([]byte, []int)
- func (m *Response) GetCode() int32
- func (m *Response) GetMsg() string
- func (m *Response) GetResultJson() []byte
- func (*Response) ProtoMessage()
- func (m *Response) Reset()
- func (m *Response) String() string
- func (m *Response) XXX_DiscardUnknown()
- func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Response) XXX_Merge(src proto.Message)
- func (m *Response) XXX_Size() int
- func (m *Response) XXX_Unmarshal(b []byte) error
- type RpcServiceClient
- type RpcServiceServer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( UserInfoNotFound = errors.New("未获取到用户信息") UserInfoParseError = errors.New("用户信息解析失败") DecodeError = "解析返回数据失败" )
View Source
var (
MethodNotFound = errors.New("没有找到对应的方法,请检查您的参数")
)
Functions ¶
func FetchUserInfo ¶
func FetchUserInfo(ctx context.Context) (*auth.CustomClaims, error)
func RegisterRpcServiceServer ¶
func RegisterRpcServiceServer(s *grpc.Server, srv RpcServiceServer)
Types ¶
type Args ¶
type Args struct { Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` Service string `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"` Args []byte `protobuf:"bytes,4,opt,name=args,proto3" json:"args,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Args) Descriptor ¶
func (*Args) GetService ¶
func (*Args) GetVersion ¶
func (*Args) ProtoMessage ¶
func (*Args) ProtoMessage()
func (*Args) XXX_DiscardUnknown ¶
func (m *Args) XXX_DiscardUnknown()
func (*Args) XXX_Unmarshal ¶
type GrpcClient ¶
type GrpcClient struct {
// contains filtered or unexported fields
}
func NewGrpcClient ¶
func NewGrpcClient(version, service, method string) (*GrpcClient, error)
func (*GrpcClient) Close ¶
func (c *GrpcClient) Close() error
func (*GrpcClient) GetConn ¶
func (c *GrpcClient) GetConn() *grpc.ClientConn
func (*GrpcClient) Invoke ¶
func (c *GrpcClient) Invoke(in *Request, ip string, userInfo *auth.CustomClaims, opts ...grpc.CallOption) (*Response, error)
func (*GrpcClient) InvokeWithTimeout ¶
func (c *GrpcClient) InvokeWithTimeout(in *Request, ip string, userInfo *auth.CustomClaims, timeout time.Duration, opts ...grpc.CallOption) (*Response, error)
func (*GrpcClient) NoAuth ¶
func (c *GrpcClient) NoAuth() bool
type Request ¶
type Request struct { RequestJson []byte `protobuf:"bytes,1,opt,name=requestJson,proto3" json:"requestJson,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func MarshalRequest ¶
func (*Request) Descriptor ¶
func (*Request) GetRequestJson ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) XXX_DiscardUnknown ¶
func (m *Request) XXX_DiscardUnknown()
func (*Request) XXX_Marshal ¶
func (*Request) XXX_Unmarshal ¶
type Response ¶
type Response struct { Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` ResultJson []byte `protobuf:"bytes,3,opt,name=resultJson,proto3" json:"resultJson,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func SuccessWithMsg ¶
func (*Response) Descriptor ¶
func (*Response) GetResultJson ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) XXX_DiscardUnknown ¶
func (m *Response) XXX_DiscardUnknown()
func (*Response) XXX_Marshal ¶
func (*Response) XXX_Unmarshal ¶
type RpcServiceClient ¶
type RpcServiceClient interface {
Invoke(ctx context.Context, in *Args, opts ...grpc.CallOption) (*Response, error)
}
RpcServiceClient is the client API for RpcService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewRpcServiceClient ¶
func NewRpcServiceClient(cc *grpc.ClientConn) RpcServiceClient
Click to show internal directories.
Click to hide internal directories.