Documentation
¶
Index ¶
- Variables
- func SetReadTimeout(second int)
- func SetWriteTimeout(second int)
- type Context
- func (c *Context) Cookie(name string) (string, error)
- func (c *Context) Data(code int, data []byte)
- func (c *Context) Fail(code int, err string)
- func (c *Context) Get(key string) (value interface{}, exists bool)
- func (c *Context) GetHeader(key string) string
- func (c *Context) HTML(code int, name string, data interface{})
- func (c *Context) JSON(code int, obj interface{})
- func (c *Context) MustGet(key string) interface{}
- func (c *Context) Next()
- func (c *Context) Param(key string) string
- func (c *Context) PostForm(key string) string
- func (c *Context) PostJson() string
- func (c *Context) Query(key string) string
- func (c *Context) Set(key string, value interface{})
- func (c *Context) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool)
- func (c *Context) SetHeader(key string, value string)
- func (c *Context) Status(code int)
- func (c *Context) String(code int, format string, values ...interface{})
- type Engine
- func (engine *Engine) LoadHTMLGlob(pattern string)
- func (engine *Engine) Run(addr string) (err error)
- func (engine *Engine) RunTLS(addr, ca, key string) (err error)
- func (engine *Engine) ServeHTTP(fastCtx *fasthttp.RequestCtx)
- func (engine *Engine) SetFuncMap(funcMap template.FuncMap)
- func (engine *Engine) Shutdown() (err error)
- type H
- type HandlerFunc
- type RouterGroup
- func (group *RouterGroup) Any(pattern string, handler HandlerFunc)
- func (group *RouterGroup) DELETE(pattern string, handler HandlerFunc)
- func (group *RouterGroup) GET(pattern string, handler HandlerFunc)
- func (group *RouterGroup) Group(prefix string) *RouterGroup
- func (group *RouterGroup) HEAD(pattern string, handler HandlerFunc)
- func (group *RouterGroup) OPTIONS(pattern string, handler HandlerFunc)
- func (group *RouterGroup) PATCH(pattern string, handler HandlerFunc)
- func (group *RouterGroup) POST(pattern string, handler HandlerFunc)
- func (group *RouterGroup) PUT(pattern string, handler HandlerFunc)
- func (group *RouterGroup) Static(relativePath string, root string)
- func (group *RouterGroup) TRACE(pattern string, handler HandlerFunc)
- func (group *RouterGroup) Use(middlewares ...HandlerFunc)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func SetReadTimeout ¶
func SetReadTimeout(second int)
func SetWriteTimeout ¶
func SetWriteTimeout(second int)
Types ¶
type Context ¶
type Context struct { // origin objects Ctx *fasthttp.RequestCtx // request info Path string Method string Params map[string]string // response info StatusCode int // Keys is a key/value pair exclusively for the context of each request. Keys map[string]interface{} // contains filtered or unexported fields }
func (*Context) Cookie ¶
Cookie returns the named cookie provided in the request or ErrNoCookie if not found. And return the named cookie is unescaped. If multiple cookies match the given name, only one cookie will be returned.
func (*Context) Get ¶
Get returns the value for the given key, ie: (value, true). If the value does not exists it returns (nil, false)
func (*Context) HTML ¶
HTML template render refer https://golang.org/pkg/html/template/
func (*Context) MustGet ¶
MustGet returns the value for the given key if it exists, otherwise it panics.
func (*Context) Set ¶
Set is used to store a new key/value pair exclusively for this context. It also lazy initializes c.Keys if it was not used previously.
type Engine ¶
type Engine struct { *RouterGroup // contains filtered or unexported fields }
Engine implement the interface of ServeHTTP
func (*Engine) LoadHTMLGlob ¶
func (*Engine) ServeHTTP ¶
func (engine *Engine) ServeHTTP(fastCtx *fasthttp.RequestCtx)
func (*Engine) SetFuncMap ¶
custom render function
type HandlerFunc ¶
type HandlerFunc func(*Context)
HandlerFunc defines the request handler used by gee
func Logger ¶
func Logger() HandlerFunc
func Recovery ¶
func Recovery() HandlerFunc
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
Engine implement the interface of ServeHTTP
func (*RouterGroup) Any ¶
func (group *RouterGroup) Any(pattern string, handler HandlerFunc)
Any registers a route that matches all the HTTP methods. GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE.
func (*RouterGroup) DELETE ¶
func (group *RouterGroup) DELETE(pattern string, handler HandlerFunc)
DELETE defines the method to add DELETE request
func (*RouterGroup) GET ¶
func (group *RouterGroup) GET(pattern string, handler HandlerFunc)
GET defines the method to add GET request
func (*RouterGroup) Group ¶
func (group *RouterGroup) Group(prefix string) *RouterGroup
Group is defined to create a new RouterGroup remember all groups share the same Engine instance
func (*RouterGroup) HEAD ¶
func (group *RouterGroup) HEAD(pattern string, handler HandlerFunc)
HEAD defines the method to add HEAD request
func (*RouterGroup) OPTIONS ¶
func (group *RouterGroup) OPTIONS(pattern string, handler HandlerFunc)
OPTIONS defines the method to add OPTIONS request
func (*RouterGroup) PATCH ¶
func (group *RouterGroup) PATCH(pattern string, handler HandlerFunc)
PATCH defines the method to add PATCH request
func (*RouterGroup) POST ¶
func (group *RouterGroup) POST(pattern string, handler HandlerFunc)
POST defines the method to add POST request
func (*RouterGroup) PUT ¶
func (group *RouterGroup) PUT(pattern string, handler HandlerFunc)
PUT defines the method to add PUT request
func (*RouterGroup) Static ¶
func (group *RouterGroup) Static(relativePath string, root string)
serve static files
func (*RouterGroup) TRACE ¶
func (group *RouterGroup) TRACE(pattern string, handler HandlerFunc)
TRACE defines the method to add TRACE request
func (*RouterGroup) Use ¶
func (group *RouterGroup) Use(middlewares ...HandlerFunc)
Use is defined to add middleware to the group