paginator: zntr.io/paginator Index | Files

package repositories

import "zntr.io/paginator"

Index

Package Files

paginator.go

Constants

const (
    // DefaultPerPage defines the default value for pagination
    DefaultPerPage uint = 20
)

type Pagination Uses

type Pagination struct {
    Page    uint
    PerPage uint
    // contains filtered or unexported fields
}

Pagination is a pagination calcul handler for database request.

func NewPaginator Uses

func NewPaginator(page, perPage uint) *Pagination

NewPaginator returns a pagination holder

func (*Pagination) CurrentPageCount Uses

func (p *Pagination) CurrentPageCount() uint

CurrentPageCount returns the element count of the current page

func (*Pagination) HasNext Uses

func (p *Pagination) HasNext() bool

HasNext returns the status if current page has a next one

func (*Pagination) HasOtherPages Uses

func (p *Pagination) HasOtherPages() bool

HasOtherPages returns the status of having previous or next pages

func (*Pagination) HasPrev Uses

func (p *Pagination) HasPrev() bool

HasPrev returns the status if current page has a previous one

func (*Pagination) NextPage Uses

func (p *Pagination) NextPage() uint

NextPage returns the page number for the next page. won't go past the end

func (*Pagination) NumPages Uses

func (p *Pagination) NumPages() uint

NumPages returns the total number of pages

func (*Pagination) Offset Uses

func (p *Pagination) Offset() uint

Offset returns the offset of first element

func (*Pagination) PrevPage Uses

func (p *Pagination) PrevPage() uint

PrevPage returns the page number for the page before this bottoms out at the first page

func (*Pagination) SetTotal Uses

func (p *Pagination) SetTotal(total uint)

SetTotal is used to defines the total count of paginated values.

func (*Pagination) Total Uses

func (p *Pagination) Total() uint

Total returns the total number of items

Package repositories imports 1 packages (graph). Updated 2020-06-13. Refresh now. Tools for package owners.