Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ManmadePage ¶
ManmadePage 手动分页,这里用泛型写更好,我是1.16的,就不用泛型改interface类型了
func manmadePage[T any](items []T, page Page) ([]T, Page) { if len(items) == 0 { return nil, page.Clone(0) } pg := page.Clone(len(items)) start, end := pg.GetStartAndEnd() items = items[start:end] return items, pg }
Types ¶
type Page ¶
type Page struct { PageIndex int `json:"pageIndex,omitempty" form:"pageIndex"` // 页码 PageSize int `json:"pageSize,omitempty" form:"pageSize"` // 每页条数 TotalCount int `json:"totalCount,omitempty"` // 总数 }
func (Page) GetStartAndEnd ¶
func (Page) PageOffsetAndLimit ¶
PageOffsetAndLimit pageIndex transfer pageOffset
Click to show internal directories.
Click to hide internal directories.