pagination

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pagination

type Pagination struct {
	// Limit is a limit of items per page
	Limit int `json:"limit" query:"limit" example:"10"`
	// Offset is a offset of items per page
	Offset int `json:"offset" query:"offset" example:"0"`
	// Page is a current page
	Page int `json:"page" query:"page" example:"1"`
}

Pagination represents a pagination of list

func Parse

func Parse(r *http.Request) *Pagination

Parse parses pagination from request

func (*Pagination) GetLimit

func (p *Pagination) GetLimit() int

GetLimit returns limit of pagination

func (*Pagination) GetOffset

func (p *Pagination) GetOffset() int

GetOffset returns offset of pagination

func (*Pagination) GetPage

func (p *Pagination) GetPage() int

GetPage returns current page

func (*Pagination) GetPages

func (p *Pagination) GetPages(total int) int

GetPages returns total count of pages

Jump to

Keyboard shortcuts

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