Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // PageParam defines the name of page parameter. PageParam = "page" // LimitParam defines the name of limit parameter. LimitParam = "limit" // MaxLimit defines a maximum number of limitation. MaxLimit int64 = 1000 // DefaultPage defines the default value of page. DefaultPage int64 = 1 // DefaultLimit defines the default value of limit. DefaultLimit int64 = 20 )
Functions ¶
This section is empty.
Types ¶
type Pagination ¶
type Pagination struct { Page int64 `json:"page"` Limit int64 `json:"limit"` Total int64 `json:"total"` Items interface{} `json:"items"` }
Pagination represents a paginated list of data items.
func New ¶
func New(page, limit int64) *Pagination
New returns a pagination with the given page and limit.
func NewFromContext ¶
func NewFromContext(ctx *clevergo.Context) *Pagination
NewFromContext returns a pagination from the given context.
func NewFromRequest ¶
func NewFromRequest(req *http.Request) *Pagination
NewFromRequest returns a pagination from the given HTTP request.
func (*Pagination) PageCount ¶
func (p *Pagination) PageCount() int64
PageCount returns the number of pages.
func (*Pagination) Pages ¶ added in v0.2.0
func (p *Pagination) Pages() (pages []int64)
Pages returns a set of page numbers for rendering pagination. Zero means dots.
func (*Pagination) UnsignedLimit ¶ added in v0.3.0
func (p *Pagination) UnsignedLimit() uint64
UnsignedLimit returns the unsigned limit.
func (*Pagination) UnsignedOffset ¶ added in v0.3.0
func (p *Pagination) UnsignedOffset() uint64
UnsignedOffset returns the unsigned offset.
func (*Pagination) UnsignedPage ¶ added in v0.3.0
func (p *Pagination) UnsignedPage() uint64
UnsignedPage returns the unsigned page.
func (*Pagination) UnsignedPageCount ¶ added in v0.3.0
func (p *Pagination) UnsignedPageCount() uint64
UnsignedPageCount returns the unsigned number of pages.
Click to show internal directories.
Click to hide internal directories.