Help us shape the future of Go! Take the 2026 Go Developer Survey

middleware

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register added in v0.6.0

func Register[T any](names []string, handler func(T) (app.HandlerFunc, error)) error

Register registers a middleware with a strongly typed config struct. It automatically handles the decoding of generic params (map[string]any) into struct T. Note: Fields in struct T should be tagged with `mapstructure` tags (e.g., `mapstructure:"prefix"`) to ensure parameters are correctly mapped and decoded from the configuration.

Types

type CreateMiddlewareHandler

type CreateMiddlewareHandler func(param any) (app.HandlerFunc, error)

CreateMiddlewareHandler is a function that creates an app.HandlerFunc from parameters.

func Factory added in v0.6.0

func Factory(kind string) CreateMiddlewareHandler

Factory returns a middleware creator for the given kind.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL