Skip to content
Myr

Add helper method to paginator for determining if we're on the last page

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent 5a1ee26 · Browse files · 1 file+9 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−1 removed

  • other:+9 added−1 removed

1 file+9 added−1 removed

modified:paginator/paginator.go+9 added-1 removed
80 unmodified lines
8182// NextPage is a helper function for navigating one page forward. It will not83// page beyond the last page (i.e. totalPages - 1).84func (m *Model) NextPage() {85 if m.Page < m.TotalPages-1 {85 if !m.OnLastPage() {86 m.Page++87 }88}8990// LastPage returns whether or not we're on the last page91func (m Model) OnLastPage() bool {92 if m.Page == m.TotalPages-1 {93 return true94 }95 return false96}9798// NewModel creates a new model with defaults99func NewModel() Model {100 return Model{101 Type: Arabic,
90 unmodified lines