context

package
Version: v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapContext

func WrapContext(ctx func(*Context), memo ...string) gin.HandlerFunc

WrapContext 包装上下文

Types

type Context

type Context struct {
	*gin.Context
}

Context 定义上下文

func NewContext

func NewContext(c *gin.Context) *Context

NewContext 创建上下文实例

func (*Context) GetPageIndex

func (a *Context) GetPageIndex() uint

GetPageIndex 获取分页的页索引

func (*Context) GetPageSize

func (a *Context) GetPageSize() uint

GetPageSize 获取分页的页大小

func (*Context) GetTraceID

func (a *Context) GetTraceID() string

GetTraceID 获取追踪ID

func (*Context) GetUserID

func (a *Context) GetUserID() string

GetUserID 获取当前用户ID

func (*Context) NewContext

func (a *Context) NewContext() context.Context

NewContext 创建上下文实例

func (*Context) ParseJSON

func (a *Context) ParseJSON(obj interface{}) error

ParseJSON 解析请求JSON

func (*Context) ResBadRequest

func (a *Context) ResBadRequest(err error, code ...int)

ResBadRequest 响应客户端请求错误

func (*Context) ResError

func (a *Context) ResError(err error, status int, code ...int)

ResError 响应错误

func (*Context) ResInternalServerError

func (a *Context) ResInternalServerError(err error, code ...int)

ResInternalServerError 响应服务器错误

func (*Context) ResList

func (a *Context) ResList(list interface{})

ResList 响应列表数据

func (*Context) ResOK

func (a *Context) ResOK()

ResOK 响应OK

func (*Context) ResPage

func (a *Context) ResPage(total int64, list interface{})

ResPage 响应分页数据

func (*Context) ResSuccess

func (a *Context) ResSuccess(obj interface{})

ResSuccess 响应成功

Source Files

Jump to

Keyboard shortcuts

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