Documentation
¶
Index ¶
- func ApplyOnewayInboundMiddleware(h transport.OnewayHandler, i OnewayInboundMiddleware) transport.OnewayHandler
- func ApplyOnewayOutboundMiddleware(o transport.OnewayOutbound, f OnewayOutboundMiddleware) transport.OnewayOutbound
- func ApplyUnaryInboundMiddleware(h transport.UnaryHandler, i UnaryInboundMiddleware) transport.UnaryHandler
- func ApplyUnaryOutboundMiddleware(o transport.UnaryOutbound, f UnaryOutboundMiddleware) transport.UnaryOutbound
- type OnewayInboundMiddleware
- type OnewayInboundMiddlewareFunc
- type OnewayOutboundMiddleware
- type OnewayOutboundMiddlewareFunc
- type UnaryInboundMiddleware
- type UnaryInboundMiddlewareFunc
- type UnaryOutboundMiddleware
- type UnaryOutboundMiddlewareFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyOnewayInboundMiddleware ¶
func ApplyOnewayInboundMiddleware(h transport.OnewayHandler, i OnewayInboundMiddleware) transport.OnewayHandler
ApplyOnewayInboundMiddleware applies the given OnewayInboundMiddleware to the given OnewayHandler.
func ApplyOnewayOutboundMiddleware ¶
func ApplyOnewayOutboundMiddleware(o transport.OnewayOutbound, f OnewayOutboundMiddleware) transport.OnewayOutbound
ApplyOnewayOutboundMiddleware applies the given OnewayOutboundMiddleware to the given OnewayOutbound.
func ApplyUnaryInboundMiddleware ¶
func ApplyUnaryInboundMiddleware(h transport.UnaryHandler, i UnaryInboundMiddleware) transport.UnaryHandler
ApplyUnaryInboundMiddleware applies the given InboundMiddleware to the given Handler.
func ApplyUnaryOutboundMiddleware ¶
func ApplyUnaryOutboundMiddleware(o transport.UnaryOutbound, f UnaryOutboundMiddleware) transport.UnaryOutbound
ApplyUnaryOutboundMiddleware applies the given UnaryOutboundMiddleware to the given UnaryOutbound.
Types ¶
type OnewayInboundMiddleware ¶
type OnewayInboundMiddleware interface {
HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
}
OnewayInboundMiddleware defines a transport-level middleware for `OnewayHandler`s.
OnewayInboundMiddleware MAY ¶
- change the context - change the request - handle the returned error - call the given handler zero or more times
OnewayInboundMiddleware MUST be thread-safe.
OnewayInboundMiddleware is re-used across requests and MAY be called multiple times for the same request.
var NopOnewayInboundMiddleware OnewayInboundMiddleware = nopOnewayInboundMiddleware{}
NopOnewayInboundMiddleware is an inbound middleware that does not do anything special. It simply calls the underlying OnewayHandler.
type OnewayInboundMiddlewareFunc ¶
type OnewayInboundMiddlewareFunc func(context.Context, *transport.Request, transport.OnewayHandler) error
OnewayInboundMiddlewareFunc adapts a function into a OnwayInboundMiddleware.
func (OnewayInboundMiddlewareFunc) HandleOneway ¶
func (f OnewayInboundMiddlewareFunc) HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
HandleOneway for OnewayInboundMiddlewareFunc
type OnewayOutboundMiddleware ¶
type OnewayOutboundMiddleware interface {
CallOneway(ctx context.Context, request *transport.Request, out transport.OnewayOutbound) (transport.Ack, error)
}
OnewayOutboundMiddleware defines transport-level middleware for `OnewayOutbound`s.
OnewayOutboundMiddleware MAY ¶
- change the context - change the request - change the returned ack - handle the returned error - call the given outbound zero or more times
OnewayOutboundMiddleware MUST ¶
- always return an Ack (nil or not) or an error. - be thread-safe
OnewayOutboundMiddleware is re-used across requests and MAY be called multiple times on the same request.
var NopOnewayOutboundMiddleware OnewayOutboundMiddleware = nopOnewayOutboundMiddleware{}
NopOnewayOutboundMiddleware is a oneway outbound middleware that does not do anything special. It simply calls the underlying OnewayOutbound.
type OnewayOutboundMiddlewareFunc ¶
type OnewayOutboundMiddlewareFunc func(context.Context, *transport.Request, transport.OnewayOutbound) (transport.Ack, error)
OnewayOutboundMiddlewareFunc adapts a function into a OnewayOutboundMiddleware.
func (OnewayOutboundMiddlewareFunc) CallOneway ¶
func (f OnewayOutboundMiddlewareFunc) CallOneway(ctx context.Context, request *transport.Request, out transport.OnewayOutbound) (transport.Ack, error)
CallOneway for OnewayOutboundMiddlewareFunc.
type UnaryInboundMiddleware ¶
type UnaryInboundMiddleware interface {
Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler) error
}
UnaryInboundMiddleware defines a transport-level middleware for `UnaryHandler`s.
UnaryInboundMiddleware MAY ¶
- change the context - change the request - call the ResponseWriter - modify the response body by wrapping the ResponseWriter - handle the returned error - call the given handler zero or more times
UnaryInboundMiddleware MUST be thread-safe.
UnaryInboundMiddleware is re-used across requests and MAY be called multiple times for the same request.
var NopUnaryInboundMiddleware UnaryInboundMiddleware = nopUnaryInboundMiddleware{}
NopUnaryInboundMiddleware is a inbound middleware that does not do anything special. It simply calls the underlying Handler.
type UnaryInboundMiddlewareFunc ¶
type UnaryInboundMiddlewareFunc func(context.Context, *transport.Request, transport.ResponseWriter, transport.UnaryHandler) error
UnaryInboundMiddlewareFunc adapts a function into an InboundMiddleware.
func (UnaryInboundMiddlewareFunc) Handle ¶
func (f UnaryInboundMiddlewareFunc) Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler) error
Handle for UnaryInboundMiddlewareFunc
type UnaryOutboundMiddleware ¶
type UnaryOutboundMiddleware interface {
Call(ctx context.Context, request *transport.Request, out transport.UnaryOutbound) (*transport.Response, error)
}
UnaryOutboundMiddleware defines transport-level middleware for `UnaryOutbound`s.
UnaryOutboundMiddleware MAY ¶
- change the context - change the request - change the returned response - handle the returned error - call the given outbound zero or more times
UnaryOutboundMiddleware MUST ¶
- always return a non-nil Response or error. - be thread-safe
UnaryOutboundMiddleware is re-used across requests and MAY be called multiple times on the same request.
var NopUnaryOutboundMiddleware UnaryOutboundMiddleware = nopUnaryOutboundMiddleware{}
NopUnaryOutboundMiddleware is a unary outbound middleware that does not do anything special. It simply calls the underlying UnaryOutbound.