Documentation ¶
Index ¶
- func ErrorResponseEncoder(encoder kitgrpc.EncodeResponseFunc, errorEncoder EncodeErrorResponseFunc) kitgrpc.EncodeResponseFunc
- func IsGRPCError(err error) bool
- func NewErrorEncoderHandler(handler kitgrpc.Handler, errorEncoder EncodeErrorResponseFunc) kitgrpc.Handler
- func ServerOptions(options []grpc.ServerOption) grpc.ServerOption
- type EncodeErrorResponseFunc
- type ServerFactory
- type StatusConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorResponseEncoder ¶ added in v0.6.0
func ErrorResponseEncoder( encoder kitgrpc.EncodeResponseFunc, errorEncoder EncodeErrorResponseFunc, ) kitgrpc.EncodeResponseFunc
ErrorResponseEncoder encodes the passed response object to a gRPC response or error.
func IsGRPCError ¶ added in v0.7.1
IsGRPCError checks if an error is already encoded as a gRPC status.
func NewErrorEncoderHandler ¶ added in v0.11.0
func NewErrorEncoderHandler(handler kitgrpc.Handler, errorEncoder EncodeErrorResponseFunc) kitgrpc.Handler
NewErrorEncoderHandler wraps a gRPC handler and encodes the returned error using the error encoder (if necessary).
For example, a returned endpoint error might need additional encoding.
func ServerOptions ¶ added in v0.2.0
func ServerOptions(options []grpc.ServerOption) grpc.ServerOption
ServerOptions collects a list of ServerOptions into a single option. Useful to avoid variadic hells when passing lists of options around.
Types ¶
type EncodeErrorResponseFunc ¶ added in v0.6.0
EncodeErrorResponseFunc transforms the passed error to a gRPC code error. It's designed to be used in gRPC servers, for server-side endpoints.
func NewDefaultStatusErrorResponseEncoder ¶ added in v0.7.0
func NewDefaultStatusErrorResponseEncoder() EncodeErrorResponseFunc
NewDefaultStatusErrorResponseEncoder returns an error response encoder that encodes errors as gRPC Status errors.
The returned encoder encodes every error as Internal error.
func NewStatusErrorResponseEncoder ¶ added in v0.7.0
func NewStatusErrorResponseEncoder(statusConverter StatusConverter) EncodeErrorResponseFunc
NewStatusErrorResponseEncoder returns an error response encoder that encodes errors as gRPC Status errors.
type ServerFactory ¶
type ServerFactory interface { // NewServer constructs a new server, which wraps the provided endpoint and implements the grpc.Handler interface. NewServer( e endpoint.Endpoint, dec grpc.DecodeRequestFunc, enc grpc.EncodeResponseFunc, options ...grpc.ServerOption, ) *grpc.Server }
ServerFactory constructs a new server, which wraps the provided endpoint and implements the grpc.Handler interface.
func NewServerFactory ¶
func NewServerFactory(options ...grpc.ServerOption) ServerFactory
NewServerFactory returns a new ServerFactory.