layer

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package layer provides Celerity's middleware model.

A layer is Go's usual middleware shape, a function that wraps the next one, so it composes with anything already written that way and needs no framework knowledge to write.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Layer

type Layer func(next Next) Next

Layer wraps the rest of the pipeline.

Work before calling next happens on the way in, work after it on the way out, and not calling it at all short-circuits, which is how a cache layer answers without reaching the handler.

func Chain

func Chain(layers ...Layer) Layer

Chain composes layers into one, applying them left to right so that the first layer given is the outermost and the handler runs innermost.

Scopes compose the same way: application layers wrap group layers, which wrap handler layers.

type Next

type Next func(ctx context.Context, ev *handler.Event) (*handler.Result, error)

Next runs the remainder of the pipeline, ending in the handler itself.

func Apply

func Apply(h handler.Func, layers ...Layer) Next

Apply runs a handler through layers, returning the composed entry point.

Jump to

Keyboard shortcuts

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