Documentation ¶
Index ¶
- func Contexter() macaron.Handler
- func Toggle(options *ToggleOptions) macaron.Handler
- type Context
- func (c *Context) Error(err error, msg string)
- func (c *Context) Errorf(err error, format string, args ...interface{})
- func (c *Context) Fail(msg string)
- func (c *Context) FormErr(names ...string)
- func (c *Context) GetErrMsg() string
- func (c *Context) HTML(status int, name string)
- func (c *Context) HTMLString(name string, content string)
- func (c *Context) HasError() bool
- func (c *Context) HasValue(name string) bool
- func (c *Context) NotFound()
- func (c *Context) NotFoundOrError(err error, msg string)
- func (c *Context) Ok(msg string)
- func (c *Context) PageIs(name string)
- func (c *Context) PlainText(status int, name []byte)
- func (c *Context) RawData(status int, v []byte)
- func (c *Context) RawTitle(title string)
- func (c *Context) RedirectSubpath(location string, status ...int)
- func (c *Context) RenderJson(data interface{})
- func (c *Context) RenderWithErr(msg, tpl string, f interface{})
- func (c *Context) Require(name string)
- func (c *Context) ReturnJson(code int64, msg string, data interface{})
- func (c *Context) ReturnLayuiJson(code int64, msg string, count int, data interface{})
- func (c *Context) Success(name string)
- func (c *Context) Title(locale string)
- type JsonData
- type LayuiData
- type ToggleOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contexter ¶
func Contexter() macaron.Handler
Contexter initializes a classic context for a request.
func Toggle ¶
func Toggle(options *ToggleOptions) macaron.Handler
Types ¶
type Context ¶
type Context struct { *macaron.Context Cache cache.Cache Flash *session.Flash Session session.Store Link string // Current request URL IsLogged bool IsBasicAuth bool IsTokenAuth bool // contains filtered or unexported fields }
Context represents context of a request.
func (*Context) HTMLString ¶
func (*Context) NotFoundOrError ¶
NotFoundOrError responses with 404 page for not found error and 500 page otherwise.
func (*Context) RedirectSubpath ¶
RedirectSubpath responses redirection with given location and status. It prepends setting.Server.Subpath to the location string.
func (*Context) RenderJson ¶
func (c *Context) RenderJson(data interface{})
JSONSuccess responses JSON with status http.StatusOK.
func (*Context) RenderWithErr ¶
RenderWithErr used for page has form validation but need to prompt error to users.
func (*Context) ReturnJson ¶
JSON Success Message
func (*Context) ReturnLayuiJson ¶
Layui JSON Success Message
type JsonData ¶
type JsonData struct { Code int64 `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data,omitempty"` }
json api common data
Click to show internal directories.
Click to hide internal directories.