Documentation
¶
Overview ¶
Package defs contains the common types and functions for all midgard handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNilHandler = errors.New("handler cannot be nil")
ErrNilHandler is returned when a handler is nil.
var ErrNilLogger = errors.New("logger cannot be nil")
ErrNilLogger is returned when a logger is nil.
var ErrNotInitialized = errors.New("middleware not initialized")
ErrNotInitialized is returned when a middleware is used before it has been initialized.
Functions ¶
func WithLogLevel ¶
WithLogLevel is a convenience function to easily write the functional options for each handler.
Types ¶
type MWBase ¶
type MWBase struct {
// contains filtered or unexported fields
}
MWBase contains the basic middleware information common to each midgard handler.
func (*MWBase) SetLogLevel ¶
SetLogLevel sets the new log level to use.
type MWBaser ¶
type MWBaser interface { // GetMWBase gets the MWBase structure out of a midgard handler. GetMWBase() *MWBase }
MWBaser is the interface used to get the basic middleware information as defined in MWBase.
type Middleware ¶
Middleware represents the common type of http middleware. The idea is to have a common interface for all types of middlewares, that is, they get an input handler and return an output handler, that is extended by the middlewares functionality. Customization is done in generator functions, that take parameters to modify the behaviour of the final http.Handler, e.g. methods to allow.