context

package
v0.0.0-...-cc65f9c Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: MIT 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 init

Types

type Context

type Context struct {
	*macaron.Context
	*SessionUser
	StartTime time.Time
	IP        string
	Secret    string
	Expire    int64
}

Context .

func (*Context) AccessDenied

func (c *Context) AccessDenied()

AccessDenied 无权限访问

func (*Context) BadRequest

func (c *Context) BadRequest(msg string)

BadRequest .

func (*Context) BadRequestByCode

func (c *Context) BadRequestByCode(code int, msg string)

BadRequestByCode .

func (*Context) BadRequestByError

func (c *Context) BadRequestByError(err error)

BadRequestByError .

func (*Context) Error

func (c *Context) Error(err error)

Error .

func (*Context) InternalServerError

func (c *Context) InternalServerError()

InternalServerError .

func (*Context) JSON

func (c *Context) JSON(i interface{})

JSON .

func (*Context) JSONAuth

func (c *Context) JSONAuth(msg string)

JSONAuth 未认证

func (*Context) JSONByCode

func (c *Context) JSONByCode(code int, i interface{})

JSONByCode .

func (*Context) JSONEmpty

func (c *Context) JSONEmpty()

JSONEmpty .

func (*Context) JSONList

func (c *Context) JSONList(count int64, listName string, list interface{})

JSONList .

func (*Context) NotFound

func (c *Context) NotFound()

NotFound .

func (*Context) ParamsID

func (c *Context) ParamsID(name string) common.ID

ParamsID .

func (*Context) QueryID

func (c *Context) QueryID(name string) common.ID

QueryID .

func (*Context) Redirect

func (c *Context) Redirect(url string)

Redirect 跳转

type JSONResult

type JSONResult struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg,omitempty"`
	Data interface{} `json:"data,omitempty"`

} //@name Result

JSONResult .

type SessionUser

type SessionUser struct {
	// UserID 用户ID
	UserID    common.ID `json:"-"`
	UserStrID string    `json:"user_id"`
	Nickname  string    `json:"nickname"`
	Avatar    string    `json:"avatar"`
}

SessionUser 会话中的用户

Jump to

Keyboard shortcuts

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