Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PaginatedList ¶
type PaginatedList struct { Page int `json:"page"` PageSize int `json:"page_size"` TotalPages int `json:"total_pages"` TotalItems int `json:"total_items"` Items interface{} `json:"items"` First string `json:"first,omitempty"` Prev string `json:"prev,omitempty"` Next string `json:"next,omitempty"` Last string `json:"last,omitempty"` }
PaginatedList represents a paginated list of data items.
func NewPaginatedList ¶
func NewPaginatedList(page, pageSize, totalItems int) *PaginatedList
NewPaginatedList creates a new Paginated instance. The page parameter is 1-based and refers to the current page index/number. The perPage parameter refers to the number of items on each page. And the total parameter specifies the total number of data items. If total is less than 0, it means total is unknown.
func (*PaginatedList) BuildPageLinks ¶
func (p *PaginatedList) BuildPageLinks(baseUrl string, defaultPageSize int)
Build page links to first, prev, next and last page
func (*PaginatedList) Limit ¶
func (p *PaginatedList) Limit() int
Limit returns the LIMIT value that can be used in a SQL statement.
func (*PaginatedList) Offset ¶
func (p *PaginatedList) Offset() int
Offset returns the OFFSET value that can be used in a SQL statement.
Click to show internal directories.
Click to hide internal directories.