handlers

package
v1.3.0 Latest Latest
Warning

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

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

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 (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.

Jump to

Keyboard shortcuts

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