Documentation ¶
Index ¶
- func IsInvalidPageError(err error) bool
- type Factory
- type InvalidPageError
- type Link
- type Paginator
- func (pg *Paginator) First() bool
- func (pg *Paginator) FirstPageUrl() string
- func (pg *Paginator) From() uint64
- func (pg *Paginator) LastPageUrl() string
- func (pg *Paginator) Links() []*Link
- func (pg *Paginator) NextPageUrl() string
- func (pg *Paginator) PreviousPageUrl() string
- func (pg *Paginator) SprintIfNotFirst(text string) string
- func (pg *Paginator) To() uint64
- func (pg *Paginator) Url(page uint64) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInvalidPageError ¶
Types ¶
type Factory ¶
type Factory struct { PageName string // PageName is a query string name to get current page from query string. PerPage uint64 // PerPage is the number of items per page. Shortcuts uint64 // Shortcuts must be odd number // contains filtered or unexported fields }
Factory is an object that can create a Paginator.
func NewFactory ¶
func NewFactory(c echo.Context) *Factory
type InvalidPageError ¶
func (*InvalidPageError) Error ¶
func (e *InvalidPageError) Error() string
type Paginator ¶
type Paginator struct { Path string // Base URL path Query url.Values // The query parameters to add to all URLs. PageName string // The parameter name of the page. ItemsCount uint64 // The number of total items. CurrentPage uint64 // The current page. Invalid bool // If the current page is not correct position, it has true. PerPage uint64 // The number of items to be shown per page. PagesCount uint64 // The number of total pages Offset uint64 // The offset. HasPrevious bool // If it has previous page PreviousPage uint64 // The previous page HasNext bool // If it has next page NextPage uint64 // The next page NumShortcuts uint64 // The maximum number of shortcut links. ShortcutPages []uint64 // The array of the shortcut pages HasMorePreviousShortcuts bool // It has more pages before shortcut links HasMoreNextShortcuts bool // It has more pages after shortcut links }
func (*Paginator) FirstPageUrl ¶
func (*Paginator) LastPageUrl ¶
func (*Paginator) NextPageUrl ¶
func (*Paginator) PreviousPageUrl ¶
func (*Paginator) SprintIfNotFirst ¶
Click to show internal directories.
Click to hide internal directories.