Documentation ¶
Index ¶
- Variables
- func Init()
- func RegisterController(controller Controller)
- func Start()
- func Test(req *http.Request, msTimeout ...int) (*http.Response, error)
- type AFH
- type BaseController
- func (c *BaseController) ActionName() string
- func (c *BaseController) AfterAction(filter func(), options ...AFH)
- func (c *BaseController) BeforeAction(filter func(), options ...AFH)
- func (c *BaseController) BodyBing(obj any)
- func (c *BaseController) ControllerName() string
- func (c *BaseController) Cookie(name string, val ...any) string
- func (c *BaseController) DB() *gorm.DB
- func (c *BaseController) FormValue(name string, defaultValue ...string) string
- func (c *BaseController) Header(name string, val ...string) string
- func (c *BaseController) Json(obj any)
- func (c *BaseController) Param(name string) string
- func (c *BaseController) Query(name string, defaultValue ...string) string
- func (c *BaseController) QueryBind(obj any)
- func (c *BaseController) RedirectTo(url string, status int)
- func (c *BaseController) Session(name string, val ...any) any
- func (c *BaseController) Text(body string)
- type Controller
- type HttpContext
- func (h *HttpContext) BodyBind(obj any) error
- func (h *HttpContext) FormValue(name string, defaultValue ...string) string
- func (h *HttpContext) GetHeader(key string) string
- func (h *HttpContext) Param(name string, defaultValue ...string) string
- func (h *HttpContext) Query(name string, defaultValue ...string) string
- func (h *HttpContext) QueryBind(obj any) error
- func (h *HttpContext) RedirectTo(url string, status int)
- func (h *HttpContext) SetHeader(key, value string)
- type Router
- func (r *Router) DELETE(path, to string)
- func (r *Router) GET(path, to string)
- func (r *Router) Namespace(name string, block func(router *Router))
- func (r *Router) POST(path, to string)
- func (r *Router) PUT(path, to string)
- func (r *Router) Resources(name string)
- func (r *Router) Scope(name string, block func(router *Router))
- type RouterInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var RouterDraw func(router *Router)
Functions ¶
func RegisterController ¶
func RegisterController(controller Controller)
Types ¶
type BaseController ¶
type BaseController struct {
// contains filtered or unexported fields
}
func (*BaseController) ActionName ¶
func (c *BaseController) ActionName() string
func (*BaseController) AfterAction ¶
func (c *BaseController) AfterAction(filter func(), options ...AFH)
func (*BaseController) BeforeAction ¶
func (c *BaseController) BeforeAction(filter func(), options ...AFH)
func (*BaseController) BodyBing ¶
func (c *BaseController) BodyBing(obj any)
func (*BaseController) ControllerName ¶
func (c *BaseController) ControllerName() string
func (*BaseController) DB ¶
func (c *BaseController) DB() *gorm.DB
func (*BaseController) FormValue ¶
func (c *BaseController) FormValue(name string, defaultValue ...string) string
func (*BaseController) Json ¶
func (c *BaseController) Json(obj any)
func (*BaseController) Param ¶
func (c *BaseController) Param(name string) string
func (*BaseController) Query ¶
func (c *BaseController) Query(name string, defaultValue ...string) string
func (*BaseController) QueryBind ¶
func (c *BaseController) QueryBind(obj any)
func (*BaseController) RedirectTo ¶
func (c *BaseController) RedirectTo(url string, status int)
func (*BaseController) Text ¶
func (c *BaseController) Text(body string)
type Controller ¶
type Controller interface {
Text(string)
}
type HttpContext ¶
type HttpContext struct {
// contains filtered or unexported fields
}
func (*HttpContext) BodyBind ¶
func (h *HttpContext) BodyBind(obj any) error
func (*HttpContext) FormValue ¶
func (h *HttpContext) FormValue(name string, defaultValue ...string) string
func (*HttpContext) GetHeader ¶
func (h *HttpContext) GetHeader(key string) string
func (*HttpContext) QueryBind ¶
func (h *HttpContext) QueryBind(obj any) error
func (*HttpContext) RedirectTo ¶
func (h *HttpContext) RedirectTo(url string, status int)
func (*HttpContext) SetHeader ¶
func (h *HttpContext) SetHeader(key, value string)
type RouterInfo ¶
func AllRoutes ¶
func AllRoutes() []RouterInfo
Click to show internal directories.
Click to hide internal directories.