Documentation
¶
Overview ¶
Package chain provides a generic chain-of-responsibility helper shared by the middleware and resilience packages, which define the same Handler/Middleware decorator shape but over different handler types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chain ¶
func Chain[H any, M ~func(H) H](outer M, others ...M) M
Chain assembles middlewares so that the first argument is the outermost (executed first) and the last is the innermost (closest to the handler):
Chain(m1, m2, m3)(h) == m1(m2(m3(h)))
H is the handler type and M is the middleware decorator type ~func(H) H. This collapses the previously duplicated middleware.Chain and resilience.Chain implementations into one generic helper.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.