pagination
pagination
import "github.com/cloudfoundry/go-cf-api/internal/apicommon/v3/pagination"
Index
func totalPages
func totalPages(totalResults int64, perPage uint16) int
type Link
type Link struct {
Href string `json:"href"`
Method string `json:"method,omitempty"`
}
func GetResourcePathLink
func GetResourcePathLink(resourcePath string) Link
func GetResourcePathLinkWithMethod
func GetResourcePathLinkWithMethod(resourcePath string, method string) Link
func nextLink
func nextLink(totalResults int64, paginationParams Params, resourcePath string) *Link
func previousLink
func previousLink(totalResults int64, paginationParams Params, resourcePath string) *Link
type Pagination
type Pagination struct {
TotalResults int64 `json:"total_results"`
TotalPages int `json:"total_pages"`
First Link `json:"first"`
Last Link `json:"last"`
Next *Link `json:"next"`
Previous *Link `json:"previous"`
}
func NewPagination
func NewPagination(totalResults int64, paginationParams Params, resourcePath string) *Pagination
type Params
type Params struct {
Page int `query:"page" validate:"gte=1"`
PerPage uint16 `query:"per_page" validate:"gte=1,lte=5000"`
}
func Default
func Default() Params
Generated by gomarkdoc