middleware

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: Apache-2.0 Imports: 2 Imported by: 10

Documentation

Overview

Package middleware implements a middleware chaining solution for Go based lambdas.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain struct {
	// contains filtered or unexported fields
}

Chain acts as a list of http.Handler constructors. Chain is effectively immutable: once created, it will always hold the same set of constructors in the same order.

func New

func New(middlewares ...Middleware) Chain

New creates a new chain

func (Chain) Then

func (c Chain) Then(h lambda.Handler) lambda.Handler

Then chains the middleware and returns the final lambda.Handler.

New(m1, m2, m3).Then(h)

is equivalent to:

m1(m2(m3(h)))

When the request comes in, it will be passed to m1, then m2, then m3 and finally, the given handler (assuming every middleware calls the following one).

func (Chain) ThenFunc

func (c Chain) ThenFunc(fn lambdaextras.HandlerFunc) lambda.Handler

ThenFunc works identically to Then, but takes a HandlerFunc instead of a Handler.

func (*Chain) Use added in v1.1.0

func (c *Chain) Use(middlewares ...Middleware)

Use append one or more middleware(s) onto the existing chain

type FieldMap added in v1.2.0

type FieldMap map[string]interface{}

FieldMap used to pass in a list of attribute value pairs

type Middleware

type Middleware func(next lambda.Handler) lambda.Handler

Middleware A constructor for a a piece of middleware. Some middleware use this constructor out of the box, so in most cases you can just pass somepackage.New

Directories

Path Synopsis
raw module
zerolog module

Jump to

Keyboard shortcuts

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