Documentation
¶
Index ¶
- func Args(values ...interface{}) map[string]interface{}
- func DateFormat(date time.Time, layout string) string
- func DateFormatString(date string, layout string) string
- func Handle(handler IHandler) gin.HandlerFunc
- func IsPage(url ...string) bool
- func Middleware(handler IHandler) gin.HandlerFunc
- func PageUrl(uri string, page int) string
- func SetTemplate(engine *gin.Engine)
- func StartCron()
- func StaticUrl(url ...string) string
- func Substr(source string, start, end int) string
- func Truncate(s string, n int) string
- func Unescaped(x string) interface{}
- func WeekDayFormat(date time.Time) string
- type ApiResponse
- type Context
- func (c *Context) ErrorMessage(err error) Response
- func (c *Context) Fail(code int, msg interface{}) Response
- func (c *Context) HTML(name string, objs ...gin.H) Response
- func (c *Context) HTMLRender(file string, obj interface{}) template.HTML
- func (c *Context) JSON(data interface{}) Response
- func (c *Context) Message(title, msg string) Response
- func (c *Context) Pagination(total int64, num, page int) *pagination.Paginater
- func (c *Context) Redirect(location string) Response
- func (c *Context) Session() sessions.Session
- func (c *Context) Status(status int)
- func (c *Context) String(format string, values ...interface{}) Response
- func (c *Context) Success(data interface{}) Response
- func (c *Context) XML(data interface{}) Response
- type HTMLProduction
- type HTMLResponse
- type HandlerFunc
- type IHandler
- type JSONResponse
- type RedirectResponse
- type Response
- type StringResponse
- type XMLResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Args ¶
func Args(values ...interface{}) map[string]interface{}
模板传递多个变量 {{template "userlist" Args "Users" .MostPopular "Current" .CurrentUser}}
func Handle ¶
func Handle(handler IHandler) gin.HandlerFunc
func Middleware ¶
func Middleware(handler IHandler) gin.HandlerFunc
func SetTemplate ¶
func WeekDayFormat ¶
Types ¶
type ApiResponse ¶
type ApiResponse struct {
HttpStatus int `json:"-"`
Context *gin.Context `json:"-"`
StatusCode int `json:"statusCode"`
Data interface{} `json:"data"`
Message string `json:"message"`
}
func (*ApiResponse) Render ¶
func (c *ApiResponse) Render()
type Context ¶
func (*Context) ErrorMessage ¶
func (*Context) HTMLRender ¶
func (*Context) Pagination ¶
func (c *Context) Pagination(total int64, num, page int) *pagination.Paginater
type HTMLProduction ¶
type HTMLProduction struct{}
type HTMLResponse ¶
type HTMLResponse struct {
HttpStatus int `json:"-"`
Context *gin.Context `json:"-"`
Name string
Data interface{}
}
func (*HTMLResponse) Render ¶
func (c *HTMLResponse) Render()
type HandlerFunc ¶
func (HandlerFunc) Handle ¶
func (h HandlerFunc) Handle(c *Context) Response
type JSONResponse ¶
type JSONResponse struct {
HttpStatus int `json:"-"`
Context *gin.Context `json:"-"`
Data interface{} `json:"data"`
}
func (*JSONResponse) Render ¶
func (c *JSONResponse) Render()
type RedirectResponse ¶
type RedirectResponse struct {
HttpStatus int `json:"-"`
Context *gin.Context `json:"-"`
Location string
}
func (*RedirectResponse) Render ¶
func (c *RedirectResponse) Render()
type StringResponse ¶
type StringResponse struct {
HttpStatus int `json:"-"`
Context *gin.Context `json:"-"`
Name string
Data []interface{}
}
func (*StringResponse) Render ¶
func (c *StringResponse) Render()
type XMLResponse ¶
type XMLResponse struct {
HttpStatus int `json:"-"`
Context *gin.Context `json:"-"`
Data interface{} `json:"data"`
}
func (*XMLResponse) Render ¶
func (c *XMLResponse) Render()
Click to show internal directories.
Click to hide internal directories.