middleware

package
v0.0.0-...-9d32939 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) *rolling.Aggregate

FromContext extracts an aggregate from the context after a request has been rejected.

func New

func New(l loadshed.Doer, options ...Option) func(http.Handler) http.Handler

New takes in options and returns a wrapped middleware

func NewContext

func NewContext(ctx context.Context, val *rolling.Aggregate) context.Context

NewContext inserts an aggregate into the context after a request has been rejected.

Types

type Middleware

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

Middleware struct represents a loadshed middleware

func (*Middleware) ServeHTTP

func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Option

type Option func(*Middleware) *Middleware

Option is a wrapper for middleware

func Callback

func Callback(cb http.Handler) Option

Callback Option adds a callback to the middleware

func ErrCodes

func ErrCodes(errCodes []int) Option

ErrCodes Option adds errcode check to the middleware

Jump to

Keyboard shortcuts

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