paging

package
v0.0.0-...-9d47661 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 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 Page

type Page struct {
	Number      int
	RowsPerPage int
}

func ParseRequest

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

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

type Response

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

Response is what is returned when a queery call is performed

func NewResponse

func NewResponse[T any](items []T, total int, page int, rowsPerPage int) Response[T]

NewResponse creates a response value for a web response.

Jump to

Keyboard shortcuts

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