Documentation
¶
Index ¶
- Constants
- type Action
- type Context
- func (c *Context) ContentType() string
- func (c *Context) Database() (*dbm.Connection, error)
- func (c *Context) Error(code int, msg string) error
- func (c *Context) GetValue(name string) interface{}
- func (c *Context) Method() string
- func (c *Context) Redirect(url string) error
- func (c *Context) RemoteIP() string
- func (c *Context) Request() *Request
- func (c *Context) RequiredParams(names string) (json.Object, error)
- func (c *Context) Response() *Response
- func (c *Context) Session() *Session
- func (c *Context) SetValue(name string, value interface{})
- func (c *Context) Status(code int, msg string) error
- func (c *Context) StatusBadRequest(msg string) error
- func (c *Context) StatusForbidden(msg string) error
- func (c *Context) StatusInternalServerError(msg string) error
- func (c *Context) StatusNotFound(msg string) error
- func (c *Context) StatusServiceUnavailable(msg string) error
- func (c *Context) StatusUnauthorized(msg string) error
- func (c *Context) Tx() (*dbm.Tx, error)
- func (c *Context) URL() *url.URL
- func (c *Context) Write(value interface{}) error
- func (c *Context) WriteBody(contentType string, body []byte) error
- func (c *Context) WriteStream(filename, contentType string, fn func(Writer)) error
- type Group
- func (g *Group) AddMiddleware(f func(*Context) error) Middleware
- func (g *Group) Get(path string) *Route
- func (g *Group) GetAction(f func(*Context) error) *Route
- func (g *Group) GetPrefixPath() string
- func (g *Group) GetSecureAction(f func(*Context) error) *Route
- func (g *Group) HandleWebsocket(path string) *Websocket
- func (g *Group) Post(path string) *Route
- func (g *Group) PostAction(f func(*Context) error) *Route
- func (g *Group) PostSecureAction(f func(*Context) error) *Route
- func (g *Group) RemoveRoute(method, path string)
- func (g *Group) SetPrefixPath(path string)
- type Middleware
- type Proxy
- type Render
- type Request
- func (r *Request) Body() []byte
- func (r *Request) File(name string) (*multipart.FileHeader, error)
- func (r *Request) Form() (*multipart.Form, error)
- func (r *Request) Header() *RequestHeader
- func (r *Request) JSON() json.Object
- func (r *Request) Method() string
- func (r *Request) QueryParam(name string) string
- func (r *Request) URL() *url.URL
- func (r *Request) ValidJSON(names ...string) (json.Object, error)
- type RequestHeader
- type Response
- func (r *Response) Body() []byte
- func (r *Response) ContentType() string
- func (r *Response) Data() json.Object
- func (r *Response) GetError() error
- func (r *Response) Header() *ResponseHeader
- func (r *Response) Put(key string, value interface{})
- func (r *Response) SetContentType(contentType string)
- func (r *Response) SetStatusCode(statusCode int)
- func (r *Response) StatusCode() int
- func (r *Response) StatusMessage() string
- type ResponseHeader
- type Route
- type Server
- func (s *Server) AddMiddleware(f func(*Context) error) Middleware
- func (s *Server) AddProxy(address string) *Proxy
- func (s *Server) Connect() error
- func (s *Server) Database() *dbm.Connection
- func (s *Server) FileRoute(path, dest, redirectTo string) error
- func (s *Server) FileRouteRemove(path string) error
- func (s *Server) Get(path string) *Route
- func (s *Server) GetAction(f func(*Context) error) *Route
- func (s *Server) Group(name string) *Group
- func (s *Server) HandleWebsocket(path string) *Websocket
- func (s *Server) HasGroup(name string) bool
- func (s *Server) MaxRequestSize(size int)
- func (s *Server) NormalizeFunc(n bool)
- func (s *Server) OpenDatabase(driver, host string, port int, username, password, name string) error
- func (s *Server) Post(path string) *Route
- func (s *Server) PostAction(f func(*Context) error) *Route
- func (s *Server) PostSecureAction(f func(*Context) error) *Route
- func (s *Server) RemoveRoute(method, path string)
- func (s *Server) Serve(port int) error
- func (s *Server) ServeUnix(filename string) error
- func (s *Server) SetDatabase(cn *dbm.Connection)
- func (s *Server) SetLogger(debug func(...interface{}), info func(...interface{}), ...)
- func (s *Server) SetRender(r Render)
- func (s *Server) Shutdown() error
- type ServerOptions
- type Session
- type Websocket
- type Writer
Constants ¶
View Source
const ( MethodGet string = fasthttp.MethodGet MethodPost string = fasthttp.MethodPost StatusBadRequest = fasthttp.StatusBadRequest StatusForbidden = fasthttp.StatusForbidden StatusNotFound = fasthttp.StatusNotFound StatusOK = fasthttp.StatusOK StatusInternalServerError = fasthttp.StatusInternalServerError StatusBadGateway = fasthttp.StatusBadGateway )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) ContentType ¶ added in v0.7.0
func (*Context) RequiredParams ¶ added in v0.11.0
func (*Context) StatusBadRequest ¶ added in v0.7.0
func (*Context) StatusForbidden ¶ added in v0.7.0
func (*Context) StatusInternalServerError ¶ added in v0.7.0
func (*Context) StatusNotFound ¶ added in v0.7.0
func (*Context) StatusServiceUnavailable ¶ added in v0.7.0
func (*Context) StatusUnauthorized ¶ added in v0.7.0
type Group ¶ added in v0.6.0
type Group struct {
// contains filtered or unexported fields
}
Group ..
func (*Group) AddMiddleware ¶ added in v0.6.0
func (g *Group) AddMiddleware(f func(*Context) error) Middleware
func (*Group) GetPrefixPath ¶ added in v0.24.1
func (*Group) GetSecureAction ¶ added in v0.7.0
func (*Group) HandleWebsocket ¶ added in v0.17.0
func (*Group) PostAction ¶ added in v0.7.0
func (*Group) PostSecureAction ¶ added in v0.7.0
func (*Group) RemoveRoute ¶ added in v0.20.0
func (*Group) SetPrefixPath ¶ added in v0.16.1
type Middleware ¶
type Middleware interface { //ForGroup set name for this middleware, this middleware only used by route that requiring the same name ForGroup(string) Middleware Secure() Middleware }
Middleware ..
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) File ¶ added in v0.11.1
func (r *Request) File(name string) (*multipart.FileHeader, error)
func (*Request) Header ¶
func (r *Request) Header() *RequestHeader
func (*Request) QueryParam ¶ added in v0.11.1
type RequestHeader ¶ added in v0.5.0
type RequestHeader struct {
// contains filtered or unexported fields
}
func (*RequestHeader) Bytes ¶ added in v0.6.0
func (r *RequestHeader) Bytes() []byte
func (*RequestHeader) Cookie ¶ added in v0.15.0
func (r *RequestHeader) Cookie(key string) string
func (*RequestHeader) Get ¶ added in v0.5.0
func (r *RequestHeader) Get(key string) string
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func (*Response) ContentType ¶ added in v0.5.0
func (*Response) Header ¶
func (r *Response) Header() *ResponseHeader
func (*Response) SetContentType ¶ added in v0.7.0
func (*Response) SetStatusCode ¶ added in v0.5.1
func (*Response) StatusCode ¶ added in v0.7.1
func (*Response) StatusMessage ¶ added in v0.7.1
type ResponseHeader ¶ added in v0.5.1
type ResponseHeader struct {
// contains filtered or unexported fields
}
func (*ResponseHeader) Add ¶ added in v0.5.1
func (r *ResponseHeader) Add(key, value string)
func (*ResponseHeader) Del ¶ added in v0.23.6
func (r *ResponseHeader) Del(key string)
func (*ResponseHeader) Get ¶ added in v0.7.0
func (r *ResponseHeader) Get(key string) string
func (*ResponseHeader) Set ¶ added in v0.5.1
func (r *ResponseHeader) Set(key, value string)
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route ...
func (*Route) AddQueryAction ¶
AddQueryAction ...
func (*Route) ResetActions ¶ added in v0.17.4
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AddMiddleware ¶
func (s *Server) AddMiddleware(f func(*Context) error) Middleware
AddMiddleware ..
func (*Server) FileRoute ¶ added in v0.4.0
FileRoute serve static file. Path parameter to determine url to be processed. Dest parameter will find directory of the file reside. RedirectTo parameter to redirect non existing file, this param can be used for SPA (ex. index.html).
func (*Server) FileRouteRemove ¶ added in v0.4.1
FileRouteRemove ...
func (*Server) HandleWebsocket ¶ added in v0.17.1
func (*Server) MaxRequestSize ¶ added in v0.11.1
func (*Server) NormalizeFunc ¶ added in v0.3.2
NormalizeFunc this func need to called before adding any routes. parameter n=true for renaming all route paths to lowercase, separated with underscore. Ex: /HelloWorld registered as /hello_world
func (*Server) OpenDatabase ¶
OpenDatabase ..
func (*Server) PostAction ¶ added in v0.7.0
func (*Server) PostSecureAction ¶ added in v0.7.0
func (*Server) RemoveRoute ¶ added in v0.21.2
func (*Server) SetDatabase ¶
func (s *Server) SetDatabase(cn *dbm.Connection)
type ServerOptions ¶ added in v0.21.0
type ServerOptions func(*Server)
func OptionTimeout ¶ added in v0.21.0
func OptionTimeout(timeout time.Duration) ServerOptions
Source Files
¶
Click to show internal directories.
Click to hide internal directories.