middleware

package
v0.0.0-...-b631e0d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMiddleware

func ApplyMiddleware(h http.HandlerFunc, middleware ...Middleware) http.HandlerFunc

ApplyMiddleware will apply all middleware, the last arguments will be the outer wrap for context passing purposes

func GetID

func GetID(ctx context.Context) string

GetID grabs an ID from a context if set otherwise it returns an empty string

func Handler

func Handler(w http.ResponseWriter, r *http.Request)

Handler is very basic

Types

type ContextID

type ContextID int

ContextID is our type to retrieve our context objects

const ID ContextID = 0

ID is the only ID we've defined

type Middleware

type Middleware func(http.HandlerFunc) http.HandlerFunc

Middleware is what all middleware functions will return

func Logger

func Logger(l *log.Logger) Middleware

Logger logs requests, this will use an id passed in via SetID()

func SetID

func SetID(start int64) Middleware

SetID updates context with the id then increments it

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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