context

package
v0.0.0-...-f123b97 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contexter

func Contexter() macaron.Handler

Contexter 初始化一个请求上下文实例。

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
	Setting *setting

	User       *db.User
	IsLogged   bool
	Service    *db.Service
	ServiceURL string
	// contains filtered or unexported fields
}

Context 为请求上下文。

func (*Context) Error

func (c *Context) Error(err error)

Error 返回模板错误页。

func (*Context) HasError

func (c *Context) HasError() bool

HasError 返回表单验证是否有错误。

func (*Context) RenderWithErr

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

RenderWithErr 返回表单报错。

func (*Context) Success

func (c *Context) Success(name string)

Success 返回模板,状态码 200。

type ToggleOptions

type ToggleOptions struct {
	SignInRequired  bool
	SignOutRequired bool
	AdminRequired   bool
}

Jump to

Keyboard shortcuts

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