Middleware
Technical reference of Middleware.
Symbols
| Symbol | Class | Description |
|---|---|---|
| Middleware | type | Middleware defines a public type of API. |
| UseMiddlewares | func | Run a chain of middlewares in order. |
Middleware
Declaration:
type Middleware[T any] func(ctx *Context, out *T) error Middleware defines a public type of API.
UseMiddlewares
Declaration:
func UseMiddlewares[T any](ctx *Context, out *T, middlewares ...Middleware[T]) error Run a chain of middlewares in order.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | *Context | Context of execution. |
out | *T | Destination where the result is decoded. |
middlewares | ...Middleware[T] | Type value ...Middleware[T] required by the operation. |
Returns
| Return | Type | Description |
|---|---|---|
err | error | nil if the operation ends correctly; otherwise, the error produced. |
Behavior
The operation returns an error when it cannot complete the above contract.
Errors
UseMiddlewares returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.
Usage syntax
err := gox.UseMiddlewares(ctx, &value, value)