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 (Chain) Then ¶
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
Click to show internal directories.
Click to hide internal directories.