letsgo

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 0 Imported by: 0

README

letsgo

CI codecov Go Report Card Go Reference

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must added in v0.3.0

func Must[T any](v T, err error) T

Must panics if err is not nil. Otherwise, it returns v.

Types

type Middleware

type Middleware[T any] func(T) T

Middleware represents a function that takes an input of type T and returns an output of type T. It is used as a building block for creating middleware chains.

func Chain

func Chain[T any](outer Middleware[T], middlewares ...Middleware[T]) Middleware[T]

Chain creates a new middleware chain by combining the provided middlewares. The outer middleware is the first one to be executed, followed by the rest of the middlewares in the order they are provided. The resulting middleware chain takes an input of type T and returns an output of type T. If no middlewares are provided, the outer middleware is returned as is. Each middleware in the chain is invoked with the output of the previous middleware as its input. The final output of the chain is the result of invoking the outer middleware with the input.

Directories

Path Synopsis
exp
kitext
log

Jump to

Keyboard shortcuts

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