middleware

package
v0.0.0-...-bf7e782 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TotalPagesHeader     = "Total-Pages"
	TotalItemCountHeader = "Total-Item-Count"
)
View Source
const (
	PageSizeParam = "page_size"
	AfterParam    = "after"
	OrderParam    = "order"
	OrderByParam  = "order_by"
)
View Source
const (
	OrderAscending  = orderDirection("asc")
	OrderDescending = orderDirection("desc")
)
View Source
const DefaultOrderByParam = "id"
View Source
const MaxPageSize = int(100)

Variables

View Source
var (
	ErrInvalidPageSizeParameter = fmt.Errorf("invalid %s parameter", PageSizeParam)
	ErrInvalidOrderByParameter  = fmt.Errorf("invalid %s parameter", OrderByParam)
	ErrInvalidOrderParameter    = fmt.Errorf("invalid %s parameter", OrderParam)
)
View Source
var (
	ErrTypeUnsupported = errors.New("internal type not supported")
	ErrEmptyOrdering   = errors.New("ordering by an empty string is invalid")
	ErrMultiTypeArray  = errors.New("only homogenously typed arrays supported")
)
View Source
var ErrPageNotFound = errors.New("requested page not found")

Functions

func SortAndPaginateAndRespond

func SortAndPaginateAndRespond(r http.Request, w http.ResponseWriter, arr []interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

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