paginator

package
v1.21.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page struct {
	// contains filtered or unexported fields
}

Page presents a page in the paginator.

func (*Page) IsCurrent

func (p *Page) IsCurrent() bool

func (*Page) Num

func (p *Page) Num() int

type Paginator

type Paginator struct {
	// contains filtered or unexported fields
}

Paginator represents a set of results of pagination calculations.

func New

func New(total, pagingNum, current, numPages int) *Paginator

New initialize a new pagination calculation and returns a Paginator as result.

func (*Paginator) Current

func (p *Paginator) Current() int

Current returns current page number.

func (*Paginator) HasNext

func (p *Paginator) HasNext() bool

HasNext returns true if there is a next page relative to current page.

func (*Paginator) HasPrevious

func (p *Paginator) HasPrevious() bool

HasPrevious returns true if there is a previous page relative to current page.

func (*Paginator) IsFirst

func (p *Paginator) IsFirst() bool

IsFirst returns true if current page is the first page.

func (*Paginator) IsLast

func (p *Paginator) IsLast() bool

IsLast returns true if current page is the last page.

func (*Paginator) Next

func (p *Paginator) Next() int

func (*Paginator) Pages

func (p *Paginator) Pages() []*Page

Pages returns a list of nearby page numbers relative to current page. If value is -1 means "..." that more pages are not showing.

func (*Paginator) PagingNum

func (p *Paginator) PagingNum() int

PagingNum returns number of page size.

func (*Paginator) Previous

func (p *Paginator) Previous() int

func (*Paginator) Total

func (p *Paginator) Total() int

Total returns number of total rows.

func (*Paginator) TotalPages

func (p *Paginator) TotalPages() int

TotalPages returns number of total pages.

Jump to

Keyboard shortcuts

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