Documentation ¶
Index ¶
- func NewClient(config *ClientConfig) *grpc.ClientConn
- type Client
- type ClientConfig
- type Server
- func (s *Server) ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
- func (s *Server) GetValidator() *validator.Validate
- func (s *Server) Metric() grpc.UnaryServerInterceptor
- func (s *Server) Server() *grpc.Server
- func (s *Server) Start() net.Addr
- func (s *Server) Stop(ctx context.Context) error
- func (s *Server) Use(interceptors ...grpc.UnaryServerInterceptor)
- func (s *Server) WithUnaryServerChain(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(config *ClientConfig) *grpc.ClientConn
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ChainUnaryClient ¶
func (c *Client) ChainUnaryClient(interceptors ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
ChainUnaryClient creates a single interceptor out of a chain of many interceptors.
Execution is done in left-to-right order, including passing of context. For example ChainUnaryClient(one, two, three) will execute one before two before three.
func (*Client) Use ¶
func (c *Client) Use(interceptors ...grpc.UnaryClientInterceptor)
Use attaches a global interceptor to the client. ie. the interceptor attached through Use() will be included in the interceptors chain for every single request. For example, this is the right place for a logger or error management interceptor.
func (*Client) WithUnaryServerChain ¶
func (c *Client) WithUnaryServerChain(interceptors ...grpc.UnaryClientInterceptor) grpc.DialOption
Chain creates a single interceptor out of a chain of many interceptors.
WithUnaryServerChain is a grpc.Client dial option that accepts multiple unary interceptors. Basically syntactic sugar.
type ClientConfig ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(config *ServerConfig) *Server
func (*Server) ChainUnaryServer ¶
func (s *Server) ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
ChainUnaryServer creates a single interceptor out of a chain of many interceptors.
Execution is done in left-to-right order, including passing of context. For example ChainUnaryServer(one, two, three) will execute one before two before three, and three will see context changes of one and two.
func (*Server) GetValidator ¶
func (s *Server) GetValidator() *validator.Validate
GetValidator returns the underlying validator engine which powers the StructValidator implementation.
func (*Server) Metric ¶
func (s *Server) Metric() grpc.UnaryServerInterceptor
func (*Server) Stop ¶
Stop stops the gRPC server gracefully. It stops the server from accepting new connections and RPCs and blocks until all the pending RPCs are finished.
func (*Server) Use ¶
func (s *Server) Use(interceptors ...grpc.UnaryServerInterceptor)
Use attaches a global interceptor to the server. ie. the interceptor attached through Use() will be included in the interceptors chain for every single request. For example, this is the right place for a logger or error management interceptor.
func (*Server) WithUnaryServerChain ¶
func (s *Server) WithUnaryServerChain(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption
Chain creates a single interceptor out of a chain of many interceptors.
WithUnaryServerChain is a grpc.Server config option that accepts multiple unary interceptors. Basically syntactic sugar.