grpc

package
v0.0.0-...-8a93dc7 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultErrorDecoder

func DefaultErrorDecoder(err error) error

DefaultErrorDecoder is default error decoder.

func DefaultErrorEncoder

func DefaultErrorEncoder(err error) error

DefaultErrorEncoder is default error encoder.

func DefaultRecoveryHandler

func DefaultRecoveryHandler(ctx context.Context, req, err interface{}) error

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

type ClientDecodeErrorFunc func(err error) error

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 ClientInsecure

func ClientInsecure() ClientOption

ClientInsecure with client insecure.

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

type RecoveryHandlerFunc func(ctx context.Context, req, err interface{}) error

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

type ServerEncodeErrorFunc func(err error) error

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.

Jump to

Keyboard shortcuts

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