parameters

package
v2.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPageSize is a default size for the pagination
	DefaultPageSize = uint32(20)
	// MinPageSize is a minimal page size for the pagination
	MinPageSize = uint32(5)
	// MinPageSize is a maximal page size for the pagination
	MaxPageSize = uint32(100)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page struct {
	// Number is the page number that starts with 1
	Number,

	Size uint32
}

Page contains all the pagination parameters

func NormalizePagination

func NormalizePagination(pageNumber, pageSize string) Page

NormalizePagination returns a struct with normalized pagination parameters

func NormalizePaginationWithValues added in v2.2.0

func NormalizePaginationWithValues(pageNumber, pageSize string, defaultPageSize, minPageSize, maxPageSize uint32) Page

NormalizePaginationWithValues returns a struct with normalized pagination parameters according to the settings

type Resolver

type Resolver interface {
	// Resolve takes the HTTP request and resolves a parameters value by the given name
	Resolve(*http.Request, string) string
}

Resolver is able to resolve a parameter value by name

func NewChiResolver

func NewChiResolver() Resolver

NewChiResolver returns a parameter resolves that uses chi-based resolver

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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