pagination

package
v0.2.56 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanPaginate

func CanPaginate(page, pageSize, count uint) bool

func PurePageArgs

func PurePageArgs(page uint, pageSize uint) (uint, uint)

func SqlNullString

func SqlNullString(value string) sql.NullString

Types

type CursorResult

type CursorResult struct {
	Results interface{} `json:"results"` // 数据
	Cursor  string      `json:"cursor"`  // 下一页
}

Cursor分页返回数据

type OrderByCol

type OrderByCol struct {
	Column string // 排序字段
	Asc    bool   // 是否正序
}

排序信息

type PageResult

type PageResult struct {
	Page    *Paging     `json:"page"`    // 分页信息
	Results interface{} `json:"results"` // 数据
}

分页返回数据

type Pagination

type Pagination struct {
	Total       uint        `json:"total"`
	PerPage     uint        `json:"per_page"`
	CurrentPage uint        `json:"current_page"`
	LastPage    uint        `json:"last_page"`
	From        uint        `json:"from"`
	To          uint        `json:"to"`
	Data        interface{} `json:"data"`
}

func EmptyPagination

func EmptyPagination(page, pageSize uint) Pagination

func Paginate

func Paginate(page, pageSize, count uint, data interface{}) Pagination

type Paging

type Paging struct {
	Page  int `json:"page"`  // 页码
	Limit int `json:"limit"` // 每页条数
	Total int `json:"total"` // 总数据条数
}

分页请求数据

func (*Paging) Offset

func (p *Paging) Offset() int

func (*Paging) TotalPage

func (p *Paging) TotalPage() int

type ParamPair

type ParamPair struct {
	Query string        // 查询
	Args  []interface{} // 参数
}

Jump to

Keyboard shortcuts

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