Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Paginator ¶
type Paginator struct {
// 总条数
TotalCount int `json:"total"`
// 当前页的数据项数量
CurrentCount int `json:"count"`
// 每页行数
Limit int `json:"per_page"`
// 当前页数
CurrentPage int `json:"current_page"`
// 总页数
TotalPages int `json:"total_pages"`
}
Paginator 分页器
func Paginate ¶
*
Paginate paginate by total count - totalCount : length of data - currentPage: current page number - limit: number of per page
func PaginateSlice ¶
func PaginateSlice(items []interface{}, currentPage, limit int) (paginate Paginator, result []interface{})
*
- PaginateSlice paginate by slice
- items : data items
- currentPage: current page number
- limit: number of per page
Click to show internal directories.
Click to hide internal directories.