Documentation ¶
Index ¶
- type MovablePaginate
- func (p *MovablePaginate) CanNext() bool
- func (p *MovablePaginate) CanPrev() bool
- func (p *MovablePaginate) Count() int64
- func (p *MovablePaginate) CountLimit() int64
- func (p *MovablePaginate) CountOffset() int64
- func (p *MovablePaginate) Counting(counter func(limit, offset int64) int64)
- func (p *MovablePaginate) First() int64
- func (p *MovablePaginate) Limit() int64
- func (p *MovablePaginate) LimitOffset() (limit, offset int64)
- func (p *MovablePaginate) MaxPage() int64
- func (p *MovablePaginate) Next() int64
- func (p *MovablePaginate) Offset() int64
- func (p *MovablePaginate) Page() int64
- func (p *MovablePaginate) Pages() []int64
- func (p *MovablePaginate) PerPage() int64
- func (p *MovablePaginate) Prev() int64
- func (p *MovablePaginate) SetCount(cnt int64) *MovablePaginate
- type Paginate
- func (p *Paginate) CanNext() bool
- func (p *Paginate) CanPrev() bool
- func (p *Paginate) Count() int64
- func (p *Paginate) Items() int64
- func (p *Paginate) Limit() int64
- func (p *Paginate) LimitOffset() (limit, offset int64)
- func (p *Paginate) MaxPage() int64
- func (p *Paginate) Next() int64
- func (p *Paginate) Offset() int64
- func (p *Paginate) Page() int64
- func (p *Paginate) Pages(around, edge int64) []int64
- func (p *Paginate) PerPage() int64
- func (p *Paginate) Prev() int64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MovablePaginate ¶ added in v1.1.0
type MovablePaginate struct {
// contains filtered or unexported fields
}
MovablePaginate is the paginate for movable list
func NewMovable ¶ added in v1.1.0
func NewMovable(page, perPage, pages int64) *MovablePaginate
NewMovable creates new movable paginate
func (*MovablePaginate) CanNext ¶ added in v1.1.0
func (p *MovablePaginate) CanNext() bool
CanNext returns is current page can go next
func (*MovablePaginate) CanPrev ¶ added in v1.1.0
func (p *MovablePaginate) CanPrev() bool
CanPrev returns is current page can go prev
func (*MovablePaginate) Count ¶ added in v1.1.0
func (p *MovablePaginate) Count() int64
Count return count
func (*MovablePaginate) CountLimit ¶ added in v1.1.1
func (p *MovablePaginate) CountLimit() int64
CountLimit returns limit for count
func (*MovablePaginate) CountOffset ¶ added in v1.1.1
func (p *MovablePaginate) CountOffset() int64
CountOffset returns offset for count
func (*MovablePaginate) Counting ¶ added in v1.1.1
func (p *MovablePaginate) Counting(counter func(limit, offset int64) int64)
Counting runs set count from counter function
func (*MovablePaginate) First ¶ added in v1.1.0
func (p *MovablePaginate) First() int64
First returns first page in paginate
func (*MovablePaginate) Limit ¶ added in v1.1.0
func (p *MovablePaginate) Limit() int64
Limit returns per page
func (*MovablePaginate) LimitOffset ¶ added in v1.1.0
func (p *MovablePaginate) LimitOffset() (limit, offset int64)
LimitOffset returns limit and offet
func (*MovablePaginate) MaxPage ¶ added in v1.1.0
func (p *MovablePaginate) MaxPage() int64
MaxPage returns max page
func (*MovablePaginate) Next ¶ added in v1.1.0
func (p *MovablePaginate) Next() int64
Next returns next page
func (*MovablePaginate) Offset ¶ added in v1.1.0
func (p *MovablePaginate) Offset() int64
Offset returns offset for current page
func (*MovablePaginate) Page ¶ added in v1.1.0
func (p *MovablePaginate) Page() int64
Page returns page
func (*MovablePaginate) Pages ¶ added in v1.1.0
func (p *MovablePaginate) Pages() []int64
Pages returns page number for paginate without last page
func (*MovablePaginate) PerPage ¶ added in v1.1.0
func (p *MovablePaginate) PerPage() int64
PerPage returns per page
func (*MovablePaginate) Prev ¶ added in v1.1.0
func (p *MovablePaginate) Prev() int64
Prev returns prev page
func (*MovablePaginate) SetCount ¶ added in v1.1.0
func (p *MovablePaginate) SetCount(cnt int64) *MovablePaginate
SetCount sets count where cnt is the count of next page to show
`select count(*) from (select * from table offset {CountOffset} limit {CountLimit}) as t;`
type Paginate ¶
type Paginate struct {
// contains filtered or unexported fields
}
Paginate type
func FromLimitOffset ¶
FromLimitOffset creates new paginate from limit, offset and count
func (*Paginate) LimitOffset ¶
LimitOffset returns limit and offet
func (*Paginate) Pages ¶
Pages returns page numbers for paginate
around is the number of page around the current page ex. if current page is 10 and around is 3 the result is 0 7 8 9 10 11 12 13 0
edge is the number of page at the edge ex. if current page is 10, max page is 20 and edge is 2 the result is 1 2 0 10 0 19 20
then if current page is 10, max page is 20, around is 3, and edge is 2 the result is 1 2 0 7 8 9 10 11 12 13 0 19 20