Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Values ¶
type Values struct {
NumPages int
HasPrev, HasNext bool
PrevPage, NextPage int
ItemsPerPage int
CurrentPage int
NumItems int
}
func Calculate ¶
pages start at 1 - not 0
Example ¶
currentPage := 2
itemsPerPage := 10
numItems := 42
pager := Calculate(currentPage, itemsPerPage, numItems)
fmt.Println("NumPages:", pager.NumPages)
fmt.Println("HasPrev:", pager.HasPrev)
fmt.Println("PrevPage:", pager.PrevPage)
fmt.Println("HasNext:", pager.HasNext)
fmt.Println("NextPage:", pager.NextPage)
Output: NumPages: 5 HasPrev: true PrevPage: 1 HasNext: true NextPage: 3
Click to show internal directories.
Click to hide internal directories.