Documentation
¶
Index ¶
- func FormToMAP(r *http.Request, maxMemory int64) map[string]interface{}
- type Config
- type Context
- type D
- type Database
- type Global
- func (g *Global) BeforeAll(handler handler)
- func (c Global) DB(dbname ...string) Database
- func (g *Global) HandleFunc(pattern, method string, handler handler, validator ...map[string]interface{})
- func (g *Global) HandleStatusCode(StatusCode int, handler handler)
- func (g *Global) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (g *Global) Start()
- func (g *Global) UseConfig(conf Config)
- func (g *Global) UseDefaultConfig()
- type M
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context struct {
W http.ResponseWriter
R *http.Request
V additional
}
Context will hold single lymon route state
type Database ¶
type Database struct {
Database *mongo.Database
Collection *mongo.Collection
}
Database export
type Global ¶
type Global struct {
Config Config
Database string
Mongo *mongo.Client
Redis *redis.Client
// MiddlewareHandler store middleware handler with ordered-array
MiddlewareHandler []handler
// Path store main route handler based on route+method that used as key
Path map[string]route
// StatusCodeHandler store handler based on http status code
StatusCodeHandler map[int]handler
}
Global hold Configuration, Database, Path and Handler data
func (*Global) BeforeAll ¶
func (g *Global) BeforeAll(handler handler)
BeforeAll Before filters are evaluated before each request within the same context as the routes. They can modify the request and response.
func (*Global) HandleFunc ¶
func (g *Global) HandleFunc(pattern, method string, handler handler, validator ...map[string]interface{})
HandleFunc registers the handler function for the given pattern.
func (*Global) HandleStatusCode ¶
HandleStatusCode with this middleware, You can customize the built-in error response, currently only works for 404
Click to show internal directories.
Click to hide internal directories.