Documentation ¶
Index ¶
- func ApplyOnewayInbound(h transport.OnewayHandler, i OnewayInbound) transport.OnewayHandler
- func ApplyOnewayOutbound(o transport.OnewayOutbound, f OnewayOutbound) transport.OnewayOutbound
- func ApplyRouteTable(r transport.RouteTable, m Router) transport.RouteTable
- func ApplyStreamInbound(h transport.StreamHandler, i StreamInbound) transport.StreamHandler
- func ApplyStreamOutbound(o transport.StreamOutbound, f StreamOutbound) transport.StreamOutbound
- func ApplyUnaryInbound(h transport.UnaryHandler, i UnaryInbound) transport.UnaryHandler
- func ApplyUnaryOutbound(o transport.UnaryOutbound, f UnaryOutbound) transport.UnaryOutbound
- type OnewayInbound
- type OnewayInboundFunc
- type OnewayOutbound
- type OnewayOutboundFunc
- type Router
- type StreamInbound
- type StreamInboundFunc
- type StreamOutbound
- type StreamOutboundFunc
- type UnaryInbound
- type UnaryInboundFunc
- type UnaryOutbound
- type UnaryOutboundFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyOnewayInbound ¶
func ApplyOnewayInbound(h transport.OnewayHandler, i OnewayInbound) transport.OnewayHandler
ApplyOnewayInbound applies the given OnewayInbound middleware to the given OnewayHandler.
func ApplyOnewayOutbound ¶
func ApplyOnewayOutbound(o transport.OnewayOutbound, f OnewayOutbound) transport.OnewayOutbound
ApplyOnewayOutbound applies the given OnewayOutbound middleware to the given OnewayOutbound transport.
func ApplyRouteTable ¶ added in v1.2.0
func ApplyRouteTable(r transport.RouteTable, m Router) transport.RouteTable
ApplyRouteTable applies the given Router middleware to the given Router.
func ApplyStreamInbound ¶ added in v1.27.0
func ApplyStreamInbound(h transport.StreamHandler, i StreamInbound) transport.StreamHandler
ApplyStreamInbound applies the given StreamInbound middleware to the given StreamHandler.
func ApplyStreamOutbound ¶ added in v1.27.0
func ApplyStreamOutbound(o transport.StreamOutbound, f StreamOutbound) transport.StreamOutbound
ApplyStreamOutbound applies the given StreamOutbound middleware to the given StreamOutbound transport.
func ApplyUnaryInbound ¶
func ApplyUnaryInbound(h transport.UnaryHandler, i UnaryInbound) transport.UnaryHandler
ApplyUnaryInbound applies the given InboundMiddleware to the given Handler.
func ApplyUnaryOutbound ¶
func ApplyUnaryOutbound(o transport.UnaryOutbound, f UnaryOutbound) transport.UnaryOutbound
ApplyUnaryOutbound applies the given UnaryOutbound middleware to the given UnaryOutbound transport.
Types ¶
type OnewayInbound ¶
type OnewayInbound interface {
HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
}
OnewayInbound defines a transport-level middleware for `OnewayHandler`s.
OnewayInbound middleware MAY do zero or more of the following: change the context, change the request, handle the returned error, call the given handler zero or more times.
OnewayInbound middleware MUST be thread-safe.
OnewayInbound middleware is re-used across requests and MAY be called multiple times for the same request.
var NopOnewayInbound OnewayInbound = nopOnewayInbound{}
NopOnewayInbound is an inbound middleware that does not do anything special. It simply calls the underlying OnewayHandler.
type OnewayInboundFunc ¶
OnewayInboundFunc adapts a function into a OnewayInbound Middleware.
func (OnewayInboundFunc) HandleOneway ¶
func (f OnewayInboundFunc) HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
HandleOneway for OnewayInboundFunc
type OnewayOutbound ¶
type OnewayOutbound interface {
CallOneway(ctx context.Context, request *transport.Request, out transport.OnewayOutbound) (transport.Ack, error)
}
OnewayOutbound defines transport-level middleware for `OnewayOutbound`s.
OnewayOutbound middleware MAY do zero or more of the following: change the context, change the request, change the returned ack, handle the returned error, call the given outbound zero or more times.
OnewayOutbound middleware MUST always return an Ack (nil or not) or an error, and they MUST be thread-safe.
OnewayOutbound middleware is re-used across requests and MAY be called multiple times on the same request.
var NopOnewayOutbound OnewayOutbound = nopOnewayOutbound{}
NopOnewayOutbound is a oneway outbound middleware that does not do anything special. It simply calls the underlying OnewayOutbound transport.
type OnewayOutboundFunc ¶
type OnewayOutboundFunc func(context.Context, *transport.Request, transport.OnewayOutbound) (transport.Ack, error)
OnewayOutboundFunc adapts a function into a OnewayOutbound middleware.
func (OnewayOutboundFunc) CallOneway ¶
func (f OnewayOutboundFunc) CallOneway(ctx context.Context, request *transport.Request, out transport.OnewayOutbound) (transport.Ack, error)
CallOneway for OnewayOutboundFunc.
type Router ¶ added in v1.2.0
type Router interface { // Procedures returns the list of procedures that can be called on this router. // Procedures SHOULD call into router that is passed in. Procedures(transport.Router) []transport.Procedure // Choose returns a HandlerSpec for the given request and transport. // If the Router cannot determine what to call it should call into the router that was // passed in. Choose(context.Context, *transport.Request, transport.Router) (transport.HandlerSpec, error) }
Router is a middleware for defining a customized routing experience for procedures
type StreamInbound ¶ added in v1.27.0
type StreamInbound interface {
HandleStream(s *transport.ServerStream, h transport.StreamHandler) error
}
StreamInbound defines a transport-level middleware for `StreamHandler`s.
StreamInbound middleware MAY do zero or more of the following: change the stream, handle the returned error, call the given handler zero or more times.
StreamInbound middleware MUST be thread-safe.
StreamInbound middleware is re-used across requests and MAY be called multiple times for the same request.
var NopStreamInbound StreamInbound = nopStreamInbound{}
NopStreamInbound is an inbound middleware that does not do anything special. It simply calls the underlying StreamHandler.
type StreamInboundFunc ¶ added in v1.27.0
type StreamInboundFunc func(*transport.ServerStream, transport.StreamHandler) error
StreamInboundFunc adapts a function into a StreamInbound Middleware.
func (StreamInboundFunc) HandleStream ¶ added in v1.27.0
func (f StreamInboundFunc) HandleStream(s *transport.ServerStream, h transport.StreamHandler) error
HandleStream for StreamInboundFunc
type StreamOutbound ¶ added in v1.27.0
type StreamOutbound interface {
CallStream(ctx context.Context, request *transport.StreamRequest, out transport.StreamOutbound) (*transport.ClientStream, error)
}
StreamOutbound defines transport-level middleware for `StreamOutbound`s.
StreamOutbound middleware MAY do zero or more of the following: change the context, change the requestMeta, change the returned Stream, handle the returned error, call the given outbound zero or more times.
StreamOutbound middleware MUST always return a non-nil Stream or error, and they MUST be thread-safe
StreamOutbound middleware is re-used across requests and MAY be called multiple times on the same request.
var NopStreamOutbound StreamOutbound = nopStreamOutbound{}
NopStreamOutbound is a stream outbound middleware that does not do anything special. It simply calls the underlying StreamOutbound.
type StreamOutboundFunc ¶ added in v1.27.0
type StreamOutboundFunc func(context.Context, *transport.StreamRequest, transport.StreamOutbound) (*transport.ClientStream, error)
StreamOutboundFunc adapts a function into a StreamOutbound middleware.
func (StreamOutboundFunc) CallStream ¶ added in v1.27.0
func (f StreamOutboundFunc) CallStream(ctx context.Context, request *transport.StreamRequest, out transport.StreamOutbound) (*transport.ClientStream, error)
CallStream for StreamOutboundFunc.
type UnaryInbound ¶
type UnaryInbound interface {
Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler) error
}
UnaryInbound defines a transport-level middleware for `UnaryHandler`s.
UnaryInbound middleware MAY do zero or more of the following: 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.
UnaryInbound middleware MUST be thread-safe.
UnaryInbound middleware is re-used across requests and MAY be called multiple times for the same request.
var NopUnaryInbound UnaryInbound = nopUnaryInbound{}
NopUnaryInbound is a inbound middleware that does not do anything special. It simply calls the underlying Handler.
type UnaryInboundFunc ¶
type UnaryInboundFunc func(context.Context, *transport.Request, transport.ResponseWriter, transport.UnaryHandler) error
UnaryInboundFunc adapts a function into an InboundMiddleware.
func (UnaryInboundFunc) Handle ¶
func (f UnaryInboundFunc) Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler) error
Handle for UnaryInboundFunc
type UnaryOutbound ¶
type UnaryOutbound interface {
Call(ctx context.Context, request *transport.Request, out transport.UnaryOutbound) (*transport.Response, error)
}
UnaryOutbound defines transport-level middleware for `UnaryOutbound`s.
UnaryOutbound middleware MAY do zero or more of the following: change the context, change the request, change the returned response, handle the returned error, call the given outbound zero or more times.
UnaryOutbound middleware MUST always return a non-nil Response or error, and they MUST be thread-safe
UnaryOutbound middleware is re-used across requests and MAY be called multiple times on the same request.
var NopUnaryOutbound UnaryOutbound = nopUnaryOutbound{}
NopUnaryOutbound is a unary outbound middleware that does not do anything special. It simply calls the underlying UnaryOutbound.
Directories ¶
Path | Synopsis |
---|---|
Package middlewaretest is a generated GoMock package.
|
Package middlewaretest is a generated GoMock package. |