contextual

package
v0.0.0-...-6f3959b Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2014 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handlers

func Handlers(handlers ...ChainedHandler) http.Handler

Handlers is a variadic function that will describe the order of contextual handlers and returns a standard http.Handler to be used for the request.

Types

type ChainLinkFunc

type ChainLinkFunc func(Handler) Handler

ChainLinkFunc is a simple func that represents a ChainedHandler

func (chain ChainLinkFunc) ChainLink(inner Handler) Handler

ChainLink is the implementation of ChainedHandler for the ChainLinkFunc

type ChainedHandler

type ChainedHandler interface {
	ChainLink(Handler) Handler
}

ChainedHandler represents a contextual chain handler that requires each handler to wrap the rest of the chain

func Last

func Last(handler Handler) ChainedHandler

Last is intended for the last handler in the chain that will not require wrapping the next handler.

type Handler

type Handler interface {
	ServeHTTP(context.Context, http.ResponseWriter, *http.Request)
}

Handler is similar to http.Handler but with the added context.Context parameter that can be used to share data between layers of an API

type HandlerFunc

type HandlerFunc func(context.Context, http.ResponseWriter, *http.Request)

HandlerFunc is a simple func to represent a contextual handler

func (HandlerFunc) ServeHTTP

func (c HandlerFunc) ServeHTTP(ctx context.Context, rw http.ResponseWriter, r *http.Request)

ServeHTTP is the HandlerFunc implementation of the contextual.Handler interface

Jump to

Keyboard shortcuts

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