Documentation ¶
Index ¶
- Constants
- type Context
- func (c *Context) Abort(code int)
- func (c *Context) Bind(obj interface{}) bool
- func (c *Context) BindWith(obj interface{}, b binding.Binding) bool
- func (c *Context) Copy() *Context
- func (c *Context) Data(code int, contentType string, data []byte)
- func (c *Context) Delete(key string)
- func (c *Context) File(filepath string)
- func (c *Context) Get(key string) (interface{}, error)
- func (c *Context) HTML(code int, name string, obj interface{})
- func (c *Context) JSON(code int, obj interface{})
- func (c *Context) MustGet(key string) interface{}
- func (c *Context) Next()
- func (c *Context) Render(code int, render render.Render, obj ...interface{})
- func (c *Context) Set(key string, item interface{})
- func (c *Context) String(code int, format string, values ...interface{})
- type Engine
- func (engine *Engine) ErrorHandler(err error, handlers ...HandlerFunc)
- func (engine *Engine) GetErrorHandler(err error) []HandlerFunc
- func (engine *Engine) GetStatusHandler(code int) []HandlerFunc
- func (engine *Engine) LoadHTMLFiles(files ...string)
- func (engine *Engine) LoadHTMLGlob(pattern string)
- func (engine *Engine) NoRoute(handlers ...HandlerFunc)
- func (engine *Engine) Run(addr string)
- func (engine *Engine) RunTLS(addr string, cert string, key string)
- func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (engine *Engine) SetHTMLTemplate(templ *template.Template)
- func (engine *Engine) StatusHandler(code int, handlers ...HandlerFunc)
- func (engine *Engine) StrictSlash(strictSlash bool) *Engine
- func (engine *Engine) Use(middlewares ...HandlerFunc)
- type HandlerFunc
- type ResponseWriter
- type RouterGroup
- func (group *RouterGroup) DELETE(pattern string, handlers ...HandlerFunc) *router.Route
- func (group *RouterGroup) GET(pattern string, handlers ...HandlerFunc) *router.Route
- func (group *RouterGroup) Group(component string, handlers ...HandlerFunc) *RouterGroup
- func (group *RouterGroup) HEAD(pattern string, handlers ...HandlerFunc) *router.Route
- func (group *RouterGroup) HandleFunc(pattern string, handlers []HandlerFunc) *router.Route
- func (group *RouterGroup) OPTIONS(pattern string, handlers ...HandlerFunc) *router.Route
- func (group *RouterGroup) PATCH(pattern string, handlers ...HandlerFunc) *router.Route
- func (group *RouterGroup) POST(pattern string, handlers ...HandlerFunc) *router.Route
- func (group *RouterGroup) PUT(pattern string, handlers ...HandlerFunc) *router.Route
- func (group *RouterGroup) Static(p, root string)
- func (group *RouterGroup) Use(middlewares ...HandlerFunc)
- type ServerWriter
Constants ¶
View Source
const ( AbortIndex = math.MaxInt8 / 2 MIMEJSON = "application/json" MIMEXML = "application/xml" MIMEXML2 = "text/xml" MIMEHTML = "text/html" MIMEPlain = "text/plain" MIMEPOSTForm = "application/x-www-form-urlencoded" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { Request *http.Request Writer ResponseWriter Keys map[string]interface{} Engine *Engine // contains filtered or unexported fields }
type Engine ¶
type Engine struct { *RouterGroup HTMLRender render.Render // contains filtered or unexported fields }
func (*Engine) ErrorHandler ¶
func (engine *Engine) ErrorHandler(err error, handlers ...HandlerFunc)
func (*Engine) GetErrorHandler ¶
func (engine *Engine) GetErrorHandler(err error) []HandlerFunc
func (*Engine) GetStatusHandler ¶
func (engine *Engine) GetStatusHandler(code int) []HandlerFunc
func (*Engine) LoadHTMLFiles ¶
func (*Engine) LoadHTMLGlob ¶
func (*Engine) NoRoute ¶
func (engine *Engine) NoRoute(handlers ...HandlerFunc)
func (*Engine) ServeHTTP ¶
func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (*Engine) SetHTMLTemplate ¶
func (*Engine) StatusHandler ¶
func (engine *Engine) StatusHandler(code int, handlers ...HandlerFunc)
func (*Engine) StrictSlash ¶
func (*Engine) Use ¶
func (engine *Engine) Use(middlewares ...HandlerFunc)
type HandlerFunc ¶
type HandlerFunc func(*Context)
func Logger ¶
func Logger() HandlerFunc
func Recovery ¶
func Recovery() HandlerFunc
Recovery returns a middleware that recovers from any panics and writes a 500 if there was one. While Martini is in development mode, Recovery will also output the panic as HTML.
type ResponseWriter ¶
type ResponseWriter interface { http.ResponseWriter GetStatus() int GetWritten() bool Status(int) Reset(http.ResponseWriter, *Context) }
type RouterGroup ¶
type RouterGroup struct { Handlers []HandlerFunc // contains filtered or unexported fields }
func (*RouterGroup) DELETE ¶
func (group *RouterGroup) DELETE(pattern string, handlers ...HandlerFunc) *router.Route
func (*RouterGroup) GET ¶
func (group *RouterGroup) GET(pattern string, handlers ...HandlerFunc) *router.Route
func (*RouterGroup) Group ¶
func (group *RouterGroup) Group(component string, handlers ...HandlerFunc) *RouterGroup
func (*RouterGroup) HEAD ¶
func (group *RouterGroup) HEAD(pattern string, handlers ...HandlerFunc) *router.Route
func (*RouterGroup) HandleFunc ¶
func (group *RouterGroup) HandleFunc(pattern string, handlers []HandlerFunc) *router.Route
func (*RouterGroup) OPTIONS ¶
func (group *RouterGroup) OPTIONS(pattern string, handlers ...HandlerFunc) *router.Route
func (*RouterGroup) PATCH ¶
func (group *RouterGroup) PATCH(pattern string, handlers ...HandlerFunc) *router.Route
func (*RouterGroup) POST ¶
func (group *RouterGroup) POST(pattern string, handlers ...HandlerFunc) *router.Route
func (*RouterGroup) PUT ¶
func (group *RouterGroup) PUT(pattern string, handlers ...HandlerFunc) *router.Route
func (*RouterGroup) Static ¶
func (group *RouterGroup) Static(p, root string)
func (*RouterGroup) Use ¶
func (group *RouterGroup) Use(middlewares ...HandlerFunc)
type ServerWriter ¶
type ServerWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func (*ServerWriter) GetStatus ¶
func (w *ServerWriter) GetStatus() int
func (*ServerWriter) GetWritten ¶
func (w *ServerWriter) GetWritten() bool
func (*ServerWriter) Reset ¶
func (w *ServerWriter) Reset(writer http.ResponseWriter, c *Context)
func (*ServerWriter) Status ¶
func (w *ServerWriter) Status(code int)
func (*ServerWriter) WriteHeader ¶
func (w *ServerWriter) WriteHeader(code int)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.