Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultPageSize = 10
)
Variables ¶
This section is empty.
Functions ¶
func CalculatePages ¶
CalculatePages 计算页面,获取带有起始值的页面的数组 @return 返回一个二维数组, 第一维是多少页,第二维是每页[]int64{start, end} e,g: 假设11个数的列表,分页pageSize是5,那么返回的是:
[]int64{ []int64{0, 5}, []int64{5, 10}, []int64{10, 11}, }
func GetLimitClause ¶ added in v1.0.57
GetLimitClause 从protobuf.ListParam生成limit语句
func GetStartEndPosition ¶
GetStartEndPosition 如果是按列表slice进行翻页的话, 计算slice的起始index
Types ¶
type Pagination ¶
func New ¶
func New(page, pageSize int64) *Pagination
func NewWithParam ¶ added in v1.0.57
func NewWithParam(listParam *protobuf.ListParam) *Pagination
func (*Pagination) GetLimitClause ¶
func (p *Pagination) GetLimitClause() string
GetLimitClause 获取limit sql子句
func (*Pagination) Paging ¶
func (p *Pagination) Paging(data interface{}) (int64, []interface{})
Paging 分页 @return total @return []interface{} 分页后的数据
Click to show internal directories.
Click to hide internal directories.