handler

package
v0.0.0-...-a88db0e Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adapt

func Adapt(h http.Handler, adapters ...Adapter) http.Handler

Types

type Adapter

type Adapter func(http.Handler) http.Handler

func WithDB

func WithDB(db *mgo.Session) Adapter

Adapter function to include a database reference within the context of the handler

type AppError

type AppError struct {
	Error   error
	Message string
	Code    int
}

AppError is the type of error that all handlers will return This error will be used in the ServeHTTP function

func AppErrorf

func AppErrorf(errorCode int, err error, format string, v ...interface{}) *AppError

AppErrorf returns a type AppError

type AppHandler

type AppHandler func(http.ResponseWriter, *http.Request) *AppError

AppHandler is a type that defines a standard handler with return type AppError

func (AppHandler) ServeHTTP

func (fn AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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