Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultMaxPerPage = 10
DefaultMaxPerPage default number of records per page
Variables ¶
View Source
var ( // ErrNoPrevPage current page is first page ErrNoPrevPage = errors.New("no previous page") // ErrNoNextPage current page is last page ErrNoNextPage = errors.New("no next page") )
Functions ¶
This section is empty.
Types ¶
type Page ¶
type Page struct { // total pages TotalPages int `json:"totalPages,omitempty"` // total elements size TotalElements int64 `json:"totalElements,omitempty"` // elements size in current page NumberOfElements int `json:"numberOfElements,omitempty"` // elements size in single page Size int `json:"size,omitempty"` // current page number Number int `json:"number,omitempty"` // stores the current page results into data argument which must be a pointer to a slice. Content interface{} `json:"content,omitempty"` }
type Paginator ¶
type Paginator interface { SetPage(page int) Page() (int, error) Results(data interface{}) error PageResults(page int, data interface{}) (*Page, error) ToPageResults(data interface{}) (*Page, error) Nums() (int64, error) HasPages() (bool, error) HasNext() (bool, error) PrevPage() (int, error) NextPage() (int, error) HasPrev() (bool, error) PageNums() (int, error) }
Paginator interface
Click to show internal directories.
Click to hide internal directories.