context

package
v0.0.0-...-9c7514e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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.

Types

type Context

type Context struct {
	*macaron.Context
	Flash *session.Flash
}

Context represents context of a request.

func (*Context) HTML

func (c *Context) HTML(status int, name string)

HTML calls Context.HTML and converts template name to string.

func (*Context) Handle

func (c *Context) Handle(status int, title string, err error)

Handle handles and logs error by given status.

func (*Context) HasError

func (c *Context) HasError() bool

HasError returns true if error occurs in form validation.

func (*Context) PageIs

func (c *Context) PageIs(name string)

PageIs sets "PageIsxxx" field in template data.

func (*Context) RenderWithErr

func (c *Context) RenderWithErr(msg string, tpl string, form interface{})

RenderWithErr used for page has form validation but need to prompt error to users.

func (*Context) Success

func (c *Context) Success(name string)

Success responses template with status http.StatusOK.

func (*Context) Title

func (c *Context) Title(locale string)

Title sets "Title" field in template data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL