Documentation ¶
Overview ¶
Package pagination provides a simple pagination inteface for ordered items with string IDs.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pageable ¶
type Pageable interface { // ExtractID derives an identifier that is guaranteed to be unique relative // to any elements with which it may coexist in a given collection ExtractID() string }
Pageable is an type that can be paginated when present in a collection.
Example ¶
package main import ( "fmt" ) type Thing string func (o Thing) ExtractID() string { return string(o) } func main() { pages := []Pageable{ Thing("foo"), Thing("bar"), Thing("baz"), Thing("boo"), Thing("bla"), } page := GetPageAfterID(pages, "bar", 2) fmt.Printf("%v", page) }
Output: [baz boo]
func GetPageAfterID ¶
GetPageAfterID paginates elements. The first element of the returned page directly follows the element in elements having an ID equivalent to after. At most pageSize results are included in the returned page.
Click to show internal directories.
Click to hide internal directories.