Documentation
¶
Overview ¶
Package middleware provide router middleware
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶ added in v4.4.0
type Collection []Middleware
Collection is a slice of handler wrappers functions
func NewCollection ¶ added in v4.4.0
func NewCollection(ms ...Middleware) Collection
NewCollection provides new middleware
func (Collection) Compose ¶ added in v4.4.0
func (c Collection) Compose(h Handler) Handler
Compose returns middleware composed to single WrapperFunc
func (Collection) Merge ¶ added in v4.4.0
func (c Collection) Merge(m Collection) Collection
Merge merges another middleware
func (Collection) Sort ¶ added in v4.4.0
func (c Collection) Sort() Collection
Sort sorts collection by priority
type Middleware ¶
type Middleware interface { // Wrap Handler with middleware Wrap(Handler) Handler // Priority provides a value for sorting Collection, lower values come first Priority() uint }
Middleware wraps Handler
func WithPriority ¶ added in v4.4.0
func WithPriority(middleware Middleware, priority uint) Middleware
WithPriority provides new Middleware with priority
type WrapperFunc ¶ added in v4.4.0
WrapperFunc is an adapter to allow the use of handler wrapper functions as middleware functions.
func (WrapperFunc) Priority ¶ added in v4.4.0
func (f WrapperFunc) Priority() (priority uint)
Priority provides a value for sorting Collection, lower values come first
func (WrapperFunc) Wrap ¶ added in v4.4.0
func (f WrapperFunc) Wrap(h Handler) Handler
Wrap implements Wrapper interface
Click to show internal directories.
Click to hide internal directories.