irisplus

package
v0.0.0-...-831d175 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// UserIDKey 存储上下文中的键(用户ID)
	UserIDKey = prefix + "/user_id"
	// TraceIDKey 存储上下文中的键(跟踪ID)
	TraceIDKey = prefix + "/trace_id"
	// ResBodyKey 存储上下文中的键(响应Body数据)
	ResBodyKey = prefix + "/res_body"
)

定义上下文中的键

Variables

This section is empty.

Functions

func GetPageIndex

func GetPageIndex(c iris.Context) int

GetPageIndex 获取分页的页索引

func GetPageSize

func GetPageSize(c iris.Context) int

GetPageSize 获取分页的页大小(最大50)

func GetPaginationParam

func GetPaginationParam(c iris.Context) *schema.PaginationParam

GetPaginationParam 获取分页查询参数

func GetToken

func GetToken(c iris.Context) string

GetToken 获取用户令牌

func GetTraceID

func GetTraceID(c iris.Context) string

GetTraceID 获取追踪ID

func GetUserID

func GetUserID(c iris.Context) string

GetUserID 获取用户ID

func NewContext

func NewContext(c iris.Context) context.Context

NewContext 封装上线文入口

func ParseJSON

func ParseJSON(c iris.Context, obj interface{}) error

ParseJSON 解析请求JSON

func ResError

func ResError(c iris.Context, err error, status ...int)

ResError 响应错误

func ResJSON

func ResJSON(c iris.Context, status int, v interface{})

ResJSON 响应JSON数据

func ResList

func ResList(c iris.Context, v interface{})

ResList 响应列表数据

func ResOK

func ResOK(c iris.Context)

ResOK 响应OK

func ResPage

func ResPage(c iris.Context, v interface{}, pr *schema.PaginationResult)

ResPage 响应分页数据

func ResSuccess

func ResSuccess(c iris.Context, v interface{})

ResSuccess 响应成功

func SetUserID

func SetUserID(c iris.Context, userID string)

SetUserID 设定用户ID

Types

type HandlerFunc

type HandlerFunc func(iris.Context)

Jump to

Keyboard shortcuts

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