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.
Click to show internal directories.
Click to hide internal directories.