Documentation ¶
Index ¶
- func DefaultErrorDecoder(err error) error
- func DefaultErrorEncoder(err error) error
- func DefaultRecoveryHandler(ctx context.Context, req, err interface{}) error
- func NewClient(target string, opts ...ClientOption) (*grpc.ClientConn, error)
- func NewContext(ctx context.Context, s ServerInfo) context.Context
- type Client
- type ClientDecodeErrorFunc
- type ClientOption
- func ClientContext(ctx context.Context) ClientOption
- func ClientErrorDecoder(d ClientDecodeErrorFunc) ClientOption
- func ClientInsecure() ClientOption
- func ClientRecoveryHandler(h RecoveryHandlerFunc) ClientOption
- func ClientTimeout(timeout time.Duration) ClientOption
- func ClientUnaryInterceptor(ints ...grpc.UnaryClientInterceptor) ClientOption
- type RecoveryHandlerFunc
- type Server
- type ServerEncodeErrorFunc
- type ServerInfo
- type ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultErrorDecoder ¶
DefaultErrorDecoder is default error decoder.
func DefaultErrorEncoder ¶
DefaultErrorEncoder is default error encoder.
func DefaultRecoveryHandler ¶
DefaultRecoveryHandler is default recovery handler.
func NewClient ¶
func NewClient(target string, opts ...ClientOption) (*grpc.ClientConn, error)
NewClient new a grpc transport client.
func NewContext ¶
func NewContext(ctx context.Context, s ServerInfo) context.Context
NewContext returns a new Context that carries value.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is grpc transport client.
type ClientDecodeErrorFunc ¶
ClientDecodeErrorFunc is encode error func.
type ClientOption ¶
type ClientOption func(o *Client)
ClientOption is gRPC client option.
func ClientContext ¶
func ClientContext(ctx context.Context) ClientOption
ClientContext with client context.
func ClientErrorDecoder ¶
func ClientErrorDecoder(d ClientDecodeErrorFunc) ClientOption
ClientErrorDecoder with client error decoder.
func ClientRecoveryHandler ¶
func ClientRecoveryHandler(h RecoveryHandlerFunc) ClientOption
ClientRecoveryHandler with recovery handler.
func ClientTimeout ¶
func ClientTimeout(timeout time.Duration) ClientOption
ClientTimeout with client timeout.
func ClientUnaryInterceptor ¶
func ClientUnaryInterceptor(ints ...grpc.UnaryClientInterceptor) ClientOption
ClientUnaryInterceptor with client unary interceptor.
type RecoveryHandlerFunc ¶
RecoveryHandlerFunc is recovery handler func.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a gRPC server wrapper.
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
NewServer creates a gRPC server by options.
func (*Server) UnaryInterceptor ¶
func (s *Server) UnaryInterceptor() grpc.UnaryServerInterceptor
UnaryInterceptor returns a unary server interceptor.
func (*Server) Use ¶
func (s *Server) Use(srv interface{}, m ...middleware.Middleware)
Use use a middleware to the transport.
type ServerEncodeErrorFunc ¶
ServerEncodeErrorFunc is encode error func.
type ServerInfo ¶
type ServerInfo struct { // Server is the service implementation the user provides. This is read-only. Server interface{} // FullMethod is the full RPC method string, i.e., /package.service/method. FullMethod string }
ServerInfo is HTTP server infomation.
func FromContext ¶
func FromContext(ctx context.Context) (s ServerInfo, ok bool)
FromContext returns the Transport value stored in ctx, if any.
type ServerOption ¶
type ServerOption func(o *Server)
ServerOption is gRPC server option.
func ServerErrorEncoder ¶
func ServerErrorEncoder(d ServerEncodeErrorFunc) ServerOption
ServerErrorEncoder with server error encoder.
func ServerMiddleware ¶
func ServerMiddleware(m ...middleware.Middleware) ServerOption
ServerMiddleware with server middleware.
func ServerRecoveryHandler ¶
func ServerRecoveryHandler(h RecoveryHandlerFunc) ServerOption
ServerRecoveryHandler with server recovery handler.