pages

package
v0.0.0-...-fb1d941 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDefPageLink(pager Selector, baseLink string) (string, error)

BuildPageLink build a string 'Link' that like as : "Link: /api/v1beta1/namespace/default/users?pageSelector=page=1,perPage=1; rel=prev, "/api/v1beta1/users?pageSelector=page=3,perPage=1; rel= next," "/api/v1beta1/users?pageSelector=page=5,perPage=1; rel=last"

Types

type Selector

type Selector interface {
	//present page.default first page must be 1
	PresentPage() (has bool, page, perPage uint64)
	//previous page
	PreviousPage() (has bool, page, perPage uint64)
	//previous page
	NextPage() (has bool, page, perPage uint64)
	//previous page
	LastPage() (has bool, page, perPage uint64)
	//set count with all of itmes
	SetItemTotal(itemsSum uint64)
	// Empty returns true if this pagination does not restrict the pagination space.
	Empty() bool
	// String returns a human readable string that represents this pager.
	String() string
	// RequirePage returns RequirePage, RequirePerPage
	RequirePage() (uint64, uint64)
	//determine condition for this request,return:hasPage, perpageCount, skipcount
	Condition(itemsSum uint64) (bool, uint64, uint64)
}

func Everything

func Everything() Selector

Everything will be return

func ParsePaginaton

func ParsePaginaton(pagination string) (Selector, error)

func SelectorFromSet

func SelectorFromSet(page, perPage uint64) Selector

Jump to

Keyboard shortcuts

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