Documentation ¶
Index ¶
- type Context
- func (this *Context) ParamFloat(key string, defVal float64) float64
- func (this *Context) ParamInt(key string, defVal int) int
- func (this *Context) ParamString(key string, defVal string) string
- func (this *Context) ServeData(status int, v []byte) error
- func (this *Context) ServeError(status int, err error) error
- func (this *Context) ServeHTML(status int, name string, binding interface{}, layout ...string) error
- func (this *Context) ServeJSON(status int, v interface{}) error
- func (this *Context) ServeJSONP(status int, callback string, v interface{}) error
- func (this *Context) ServeText(status int, v string) error
- func (this *Context) ServeXML(status int, v interface{}) error
- type ControllerRouter
- type HTTPHandler
- type JSON
- type Next
- type Restgo
- func (this *Restgo) All(path string, handlers ...HTTPHandler) *Router
- func (this *Restgo) DELETE(path string, handlers ...HTTPHandler) *Router
- func (this *Restgo) GET(path string, handlers ...HTTPHandler) *Router
- func (this *Restgo) HEAD(path string, handlers ...HTTPHandler) *Router
- func (this *Restgo) OPTIONS(path string, handlers ...HTTPHandler) *Router
- func (this *Restgo) PATCH(path string, handlers ...HTTPHandler) *Router
- func (this *Restgo) POST(path string, handlers ...HTTPHandler) *Router
- func (this *Restgo) PUT(path string, handlers ...HTTPHandler) *Router
- func (this *Restgo) Route(path string) *Route
- func (this *Restgo) Router(renderConfig ...*render.Config) *Router
- func (this *Restgo) Run(addr ...string)
- func (this *Restgo) Use(handlers ...interface{}) *Router
- type Route
- func (this *Route) All(handlers ...HTTPHandler) *Route
- func (this *Route) DELETE(handlers ...HTTPHandler) *Route
- func (this *Route) GET(handlers ...HTTPHandler) *Route
- func (this *Route) HEAD(handlers ...HTTPHandler) *Route
- func (this *Route) HTTPHandler(ctx *Context, done Next)
- func (this *Route) OPTIONS(handlers ...HTTPHandler) *Route
- func (this *Route) PATCH(handlers ...HTTPHandler) *Route
- func (this *Route) POST(handlers ...HTTPHandler) *Route
- func (this *Route) PUT(handlers ...HTTPHandler) *Route
- type Router
- func (this *Router) All(path string, handlers ...HTTPHandler) *Router
- func (this *Router) DELETE(path string, handlers ...HTTPHandler) *Router
- func (this *Router) FastHttpHandler(ctx *fasthttp.RequestCtx)
- func (this *Router) GET(path string, handlers ...HTTPHandler) *Router
- func (this *Router) HEAD(path string, handlers ...HTTPHandler) *Router
- func (this *Router) HTTPHandler(ctx *Context, next Next)
- func (this *Router) OPTIONS(path string, handlers ...HTTPHandler) *Router
- func (this *Router) PATCH(path string, handlers ...HTTPHandler) *Router
- func (this *Router) POST(path string, handlers ...HTTPHandler) *Router
- func (this *Router) PUT(path string, handlers ...HTTPHandler) *Router
- func (this *Router) Route(path string) *Route
- func (this *Router) Use(handlers ...interface{}) *Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { *fasthttp.RequestCtx *render.Render }
func (*Context) ParamFloat ¶
Get path parameter or query parameter as float64. if not exist, default value will be returned
func (*Context) ParamInt ¶
Get path parameter or query parameter as int. if not exist, default value will be returned
func (*Context) ParamString ¶
Get path parameter or query parameter as string. if not exist, default value will be returned
func (*Context) ServeJSONP ¶
type ControllerRouter ¶
type ControllerRouter interface {
Route(*Router)
}
controller implement this interface to init router for it
type HTTPHandler ¶
type Restgo ¶
type Restgo struct {
// contains filtered or unexported fields
}
func App ¶
create app instance, give render config or use default(pass nothing) lean how to config render here : https://github.com/unrolled/render
func (*Restgo) All ¶
func (this *Restgo) All(path string, handlers ...HTTPHandler) *Router
set handlers for all types requests
func (*Restgo) DELETE ¶
func (this *Restgo) DELETE(path string, handlers ...HTTPHandler) *Router
set handlers for `DELETE` request
func (*Restgo) GET ¶
func (this *Restgo) GET(path string, handlers ...HTTPHandler) *Router
set handlers for `GET` request
func (*Restgo) HEAD ¶
func (this *Restgo) HEAD(path string, handlers ...HTTPHandler) *Router
set handlers for `HEAD` request
func (*Restgo) OPTIONS ¶
func (this *Restgo) OPTIONS(path string, handlers ...HTTPHandler) *Router
set handlers for `OPTIONS` request
func (*Restgo) PATCH ¶
func (this *Restgo) PATCH(path string, handlers ...HTTPHandler) *Router
set handlers for `PATCH` request
func (*Restgo) POST ¶
func (this *Restgo) POST(path string, handlers ...HTTPHandler) *Router
set handlers for `POST` request
func (*Restgo) PUT ¶
func (this *Restgo) PUT(path string, handlers ...HTTPHandler) *Router
set handlers for `PUT` request
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
func (*Route) All ¶
func (this *Route) All(handlers ...HTTPHandler) *Route
all types requests will go into registered handler
func (*Route) DELETE ¶
func (this *Route) DELETE(handlers ...HTTPHandler) *Route
register handlers for `DELETE` request
func (*Route) GET ¶
func (this *Route) GET(handlers ...HTTPHandler) *Route
register handlers for `GET` request
func (*Route) HEAD ¶
func (this *Route) HEAD(handlers ...HTTPHandler) *Route
register handlers for `HEAD` request
func (*Route) HTTPHandler ¶
implement HTTPHandle interface, so you can use it as a handler
func (*Route) OPTIONS ¶
func (this *Route) OPTIONS(handlers ...HTTPHandler) *Route
register handlers for `OPTIONS` request
func (*Route) PATCH ¶
func (this *Route) PATCH(handlers ...HTTPHandler) *Route
register handlers for `PATCH` request
func (*Route) POST ¶
func (this *Route) POST(handlers ...HTTPHandler) *Route
register handlers for `POST` request
func (*Route) PUT ¶
func (this *Route) PUT(handlers ...HTTPHandler) *Route
register handlers for `PUT` request
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) All ¶
func (this *Router) All(path string, handlers ...HTTPHandler) *Router
set handlers for all types requests
func (*Router) DELETE ¶
func (this *Router) DELETE(path string, handlers ...HTTPHandler) *Router
set handlers for `DELETE` request
func (*Router) FastHttpHandler ¶
func (this *Router) FastHttpHandler(ctx *fasthttp.RequestCtx)
implement fasthttp.RequestHandler function
func (*Router) GET ¶
func (this *Router) GET(path string, handlers ...HTTPHandler) *Router
set handlers for `GET` request
func (*Router) HEAD ¶
func (this *Router) HEAD(path string, handlers ...HTTPHandler) *Router
set handlers for `HEAD` request
func (*Router) HTTPHandler ¶
implement HTTPHandler interface, make it can be as a handler
func (*Router) OPTIONS ¶
func (this *Router) OPTIONS(path string, handlers ...HTTPHandler) *Router
set handlers for `OPTIONS` request
func (*Router) PATCH ¶
func (this *Router) PATCH(path string, handlers ...HTTPHandler) *Router
set handlers for `PATCH` request
func (*Router) POST ¶
func (this *Router) POST(path string, handlers ...HTTPHandler) *Router
set handlers for `POST` request