query

package
v3.37.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidValue occurs when value is in invalid format
	ErrInvalidValue = errors.New("invalid value")

	// ErrMaxPageSizeExceeded occurs when pagesize read is above defined limit
	ErrMaxPageSizeExceeded = errors.New("maximum page size exceeded")

	// ErrPageSizeInvalid occurs when pagesize read is equal to 0
	ErrPageSizeInvalid = errors.New("page size must be greater than zero")
)
View Source
var (
	// ErrInvalidInteger occurs when value is not an integer
	ErrInvalidInteger = errors.New("invalid unsigned integer value for ID")
)

Functions

func GetBool

func GetBool(r *http.Request, name string) bool

GetBool converts query params to boolean

func GetID

func GetID(r *http.Request) string

GetID return ID of URL (first section between two slashes)

func GetUintID added in v3.2.2

func GetUintID(r *http.Request) (uint64, error)

GetUintID return ID of URL (first section between two slashes) as int64

func IsRoot

func IsRoot(r *http.Request) bool

IsRoot checks if current path is root (empty or only trailing slash)

Types

type Pagination

type Pagination struct {
	Sort     string
	Page     uint
	PageSize uint
	Desc     bool
}

Pagination describes pagination params

func ParsePagination

func ParsePagination(r *http.Request, defaultPage, defaultPageSize, maxPageSize uint) (pagination Pagination, err error)

ParsePagination parse common pagination param from request

Jump to

Keyboard shortcuts

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