Help us shape the future of Go! Take the 2026 Go Developer Survey

paginator

package
v3.1.61 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT, MIT Imports: 1 Imported by: 0

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) SetCurRows

func (p *Paginator) SetCurRows(rows 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.

Source Files

  • paginator.go

Jump to

Keyboard shortcuts

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