gintool

package
v0.0.0-...-cf06ac5 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: GPL-3.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

View Source
const (
	Success = iota
	Fail
)

Variables

This section is empty.

Functions

func ClearAllSession

func ClearAllSession(ctx *gin.Context)

func GetSession

func GetSession(ctx *gin.Context, k string) interface{}

func Logger

func Logger() gin.HandlerFunc

func RemoveSession

func RemoveSession(ctx *gin.Context, k string)

func ResultFail

func ResultFail(ctx *gin.Context, err interface{})

func ResultFailData

func ResultFailData(ctx *gin.Context, data interface{}, err interface{})

func ResultList

func ResultList(ctx *gin.Context, data interface{}, total int64)

func ResultMap

func ResultMap(ctx *gin.Context, m map[string]interface{})

func ResultMsg

func ResultMsg(ctx *gin.Context, msg string)

func ResultOk

func ResultOk(ctx *gin.Context, data interface{})

func ResultOkMsg

func ResultOkMsg(ctx *gin.Context, data interface{}, msg string)

func ResultPageList

func ResultPageList(ctx *gin.Context, data interface{}, pager interface{})

func SetSession

func SetSession(ctx *gin.Context, k string, o interface{})

func UseSession

func UseSession(router *gin.Engine)

Types

type Pager

type Pager struct {
	Page      int `form:"page"  json:"page"`           //当前页
	PageSize  int `form:"pageSize"  json:"pageSize"`   //每页条数
	Total     int `form:"total"  json:"total"`         //总条数
	PageCount int `form:"pageCount"  json:"pageCount"` //总页数
	NumStart  int `form:"numStart"  json:"numStart"`   //开始序数
}

分页对象

func CreatePager

func CreatePager(page, pagesize int) *Pager

func (*Pager) SetTotal

func (p *Pager) SetTotal(total int)

type RespData

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

type RespDataList

type RespDataList struct {
	RespData
	Total int64 `json:"total"`
}

*

@param  total  :总数
@param  pageNum : 当前页

type RespDataPager

type RespDataPager struct {
	RespData
	Pager interface{} `json:"pager"`
}

Jump to

Keyboard shortcuts

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