page

package
v0.0.0-...-50176c9 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPageSize 默认分页大小
	DefaultPageSize int = 10

	// MaxPageSize 最大分页大小
	MaxPageSize int = 5000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page struct {
	Page         int         `json:"page"`
	Size         int         `json:"size"`
	TotalRecords int         `json:"totalRecords"`
	TotalPages   int         `json:"totalPages"`
	Items        interface{} `json:"items"`
}

Page 分页信息

func New

func New(page, size int) Page

New 新建一个Fixed Page对象

func NewDefaultFromString

func NewDefaultFromString(cur, size string, curDefault, sizeDefault int) Page

NewDefaultFromString 从字符串中生成一个新的page cur 当前页,从1开始 size 分页大小 如果cur和size int 转换失败,分别转换成 defalult

func NewFromString

func NewFromString(cur, size string) Page

NewFromString 从字符串中生成一个新的page cur 当前页,从1开始 size 分页大小 如果cur和size int 转换失败,分别转换成 defalult

func Paging

func Paging(curPage int, pageSize int, totalRecords int, items interface{}) Page

Paging 产生分页信息

func PagingPage

func PagingPage(p Page, totalRecords int, items interface{}) Page

PagingPage 从分页对象中获取当前页和页码

func (Page) Offset

func (p Page) Offset() int

Offset 用于pg 分页参数偏移

func (Page) Paging

func (p Page) Paging() Page

Paging 分页

Jump to

Keyboard shortcuts

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