Documentation ¶
Index ¶
Constants ¶
View Source
const ( GET string = "GET" POST string = "POST" PUT string = "PUT" DELETE string = "DELETE" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppContext ¶
type AppContext struct { Writer http.ResponseWriter Header http.Header Body io.ReadCloser Vars map[string]string MDB *db.MongoDB RMQ *amqp.MQ SD *statsd.SD Event string }
AppContext encapsulates application specific runtime information
func NewContext ¶
func NewContext(rw http.ResponseWriter, r *http.Request) *AppContext
func (*AppContext) Clone ¶
func (c *AppContext) Clone() *AppContext
Returns a cloned context with db and mq resources A cloned context must not be closed
func (*AppContext) Close ¶
func (c *AppContext) Close()
func (*AppContext) GetValue ¶
func (c *AppContext) GetValue(key string) string
func (*AppContext) Marshall ¶
func (c *AppContext) Marshall(j interface{})
Marshall marshalls an incoming object and sets it to the Body
func (*AppContext) Unmarshall ¶
func (c *AppContext) Unmarshall(input interface{}) error
Unmarshall unmarshalls the Body to the passed object
type AppError ¶
type AppError struct { Error error `json:"error,omitempty"` Message string `json:"message,omitempty"` Code int `json:"code,omitempty"` }
AppError encapsulates application specific error
type HandlerFunc ¶
type HandlerFunc func(c *AppContext)
overwrites the handlerfunc
func (HandlerFunc) ServeHTTP ¶
func (h HandlerFunc) ServeHTTP(rw http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.