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(code int64, msg string)
- func (c *Context) FormErr(names ...string)
- func (c *Context) GetErrMsg() string
- func (c *Context) HTML(status int, name string)
- func (c *Context) HasError() bool
- func (c *Context) HasValue(name string) bool
- func (c *Context) JSONSuccess(data interface{})
- func (c *Context) NotFound()
- func (c *Context) NotFoundOrError(err error, msg string)
- func (c *Context) OK(msg string)
- func (c *Context) OKDATA(msg string, data interface{})
- func (c *Context) PageIs(name string)
- func (c *Context) RawTitle(title string)
- func (c *Context) RedirectSubpath(location string, status ...int)
- func (c *Context) RenderWithErr(msg, tpl string, f interface{})
- func (c *Context) Require(name string)
- func (c *Context) Success(name string)
- func (c *Context) Title(locale string)
- type JsonMsg
- 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 User *db.User IsLogged bool IsBasicAuth bool IsTokenAuth bool // contains filtered or unexported fields }
Context represents context of a request.
func (*Context) JSONSuccess ¶
func (c *Context) JSONSuccess(data interface{})
JSONSuccess responses JSON with status http.StatusOK.
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) RenderWithErr ¶
RenderWithErr used for page has form validation but need to prompt error to users.
Click to show internal directories.
Click to hide internal directories.