pagination

package
v1.0.3-0...-1c8bd4c Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPagingSize = 100
View Source
const FirstPage = 1
View Source
const MaxPagingSize = 2000

Variables

This section is empty.

Functions

This section is empty.

Types

type Limit

type Limit int64

func LimitOf

func LimitOf(l int64) Limit

func (Limit) Iter

func (limit Limit) Iter(exec func(i int64) (bool, *errors.Error), skipErr bool) *errors.Error

func (Limit) To

func (limit Limit) To() int64

type Page

type Page struct {
	Size int64 `json:"size"` // Page Size, default 100
	Numb int64 `json:"numb"` // Page Numb, From One
}

func PageALL

func PageALL() *Page

type Pagination

type Pagination struct {
	Paging *Paging       `bson:"paging" json:"paging"`
	Items  []interface{} `bson:"items" json:"items"`
}

func PagingWrap

func PagingWrap[T interface{}](paging *Paging, arr []*T, wrap func(m *T) interface{}) Pagination

type Paging

type Paging struct {
	Size  int64 `json:"size"`  // Page Size, default 100
	Numb  int64 `json:"numb"`  // Page Numb, From One
	Total int64 `json:"total"` // Page Total, The Page Total
	Count int64 `json:"count"` // Item Count, The Item Count
}

func PagingALL

func PagingALL() Paging

func PagingOf

func PagingOf(size int64, current int64) Paging

func PagingOfPage

func PagingOfPage(page *Page) Paging

func (*Paging) Limit

func (paging *Paging) Limit() int64

func (*Paging) Skip

func (paging *Paging) Skip() int64

func (*Paging) ToString

func (paging *Paging) ToString() string

func (*Paging) WithCount

func (paging *Paging) WithCount(count int64)

Jump to

Keyboard shortcuts

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