Documentation
¶
Overview ¶
Package middleware provides a middleware interface for ogen.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HookMiddleware ¶
func HookMiddleware[RequestType, ParamsType, ResponseType any]( m Middleware, req Request, unpack func(map[string]any) ParamsType, cb func(context.Context, RequestType, ParamsType) (ResponseType, error), ) (r ResponseType, err error)
HookMiddleware is a helper that does ogen request type -> Request type conversion.
NB: this is an internal func, not intended for public use.
Types ¶
type Middleware ¶
Middleware is middleware type.
func ChainMiddlewares ¶
func ChainMiddlewares(m ...Middleware) Middleware
ChainMiddlewares chains middlewares into a single middleware, which will be executed in the order they are passed.
type Request ¶
type Request struct {
// Context is request context.
Context context.Context
// OperationName is the ogen operation name. It is guaranteed to be unique and not empty.
OperationName string
// OperationID is the spec operation ID, if any.
OperationID string
// Body is the operation request body. May be nil, if the operation has not body.
Body any
// Params is the operation parameters.
Params map[string]any
// Raw is the raw http request.
Raw *http.Request
}
Request is request context type for middleware.
Click to show internal directories.
Click to hide internal directories.