parent
c149bbfc06
commit
60823564d4
@ -1,26 +1,26 @@
|
||||
package navigation
|
||||
|
||||
// PaginationBinder is an interface that everything that every type that wants to bind to an pagination component must implement.
|
||||
// PaginationBinder is an interface that everything that every type that wants to bind to a pagination component must implement.
|
||||
type PaginationBinder interface {
|
||||
Page() int // Page returns the current page, as a 1-based index. A value of 0 means there is no active page.
|
||||
Pages() int // Pages returns the total number of pages.
|
||||
SetPage(page int) // SetPage changes the current page as a 1-based index. A value of 0 means there is no active page.
|
||||
PaginationPage() int // Page returns the current page, as a 1-based index. A value of 0 means there is no active page.
|
||||
PaginationPages() int // Pages returns the total number of pages.
|
||||
SetPaginationPage(page int) // SetPage changes the current page as a 1-based index. A value of 0 means there is no active page.
|
||||
}
|
||||
|
||||
// PaginationInfo implements the PaginationBinder interface and represents the current state of a pagination component.
|
||||
type PaginationInfo struct {
|
||||
CurrentPage int // The current page as a 1-based index. A value of 0 means there is no current page.
|
||||
TotalPages int // The number of total pages.
|
||||
Page int // The current page as a 1-based index. A value of 0 means there is no current page.
|
||||
Pages int // The number of total pages.
|
||||
}
|
||||
|
||||
func (p *PaginationInfo) Page() int {
|
||||
return p.CurrentPage
|
||||
func (p *PaginationInfo) PaginationPage() int {
|
||||
return p.Page
|
||||
}
|
||||
|
||||
func (p *PaginationInfo) Pages() int {
|
||||
return p.TotalPages
|
||||
func (p *PaginationInfo) PaginationPages() int {
|
||||
return p.Pages
|
||||
}
|
||||
|
||||
func (p *PaginationInfo) SetPage(page int) {
|
||||
p.CurrentPage = page
|
||||
func (p *PaginationInfo) SetPaginationPage(page int) {
|
||||
p.Page = page
|
||||
}
|
||||
|
Loading…
Reference in New Issue