page

package
v0.0.0-...-c64bf0e Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package page provides support for query paging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document[T any] struct {
	Items       []T `json:"items"`
	Total       int `json:"total"`
	Page        int `json:"page"`
	RowsPerPage int `json:"rowsPerPage"`
}

Document is the form used for API responses from query API calls.

func NewDocument

func NewDocument[T any](items []T, total int, page int, rowsPerPage int) Document[T]

NewDocument constructs a response value for a web paging trusted.

type Page

type Page struct {
	Number      int
	RowsPerPage int
}

Page represents the requested page and rows per page.

func Parse

func Parse(r *http.Request) (Page, error)

Parse parses the request for the page and rows query string. The defaults are provided as well.

Jump to

Keyboard shortcuts

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