paging

package
v0.0.0-...-8d7bd48 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package paging provides support for query paging.

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
}

Page represents the requested page and rows per page.

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 query call is performed.

func NewResponse

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

NewResponse constructs 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