chain

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 0 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Jump to

Keyboard shortcuts

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