page

package
v0.0.0-...-16f3005 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page[T interface{}] struct {
	Empty            bool  `json:"empty"`
	First            bool  `json:"first"`
	Last             bool  `json:"last"`
	Number           int   `json:"number"`
	NumberOfElements int   `json:"numberOfElements"`
	Size             int   `json:"size"`
	TotalElements    int64 `json:"totalElements"`
	TotalPages       int   `json:"totalPages"`
	Content          []*T  `json:"content"`
	Extra            any   `json:"extra" describe:"额外信息"`
}

func EmptyPage

func EmptyPage[T interface{}]() *Page[T]

func Map

func Map[T interface{}, N interface{}](old *Page[T], mapfunc func(t *T) *N) *Page[N]

Map 转换page类型

func NewPage

func NewPage[T interface{}](content []*T, total int64, pageable *Pageable) *Page[T]

type Pageable

type Pageable struct {
	sort.Sort
	Page int `form:"page" json:"page" describe:"页码从0开始"`
	Size int `form:"size" json:"size" describe:"每页的大小"`
}

Pageable 分页请求

func NewDefaultPageable

func NewDefaultPageable() *Pageable

func NewPageable

func NewPageable(page int, size int) *Pageable

func NewPageableWithSort

func NewPageableWithSort(page int, size int, s sort.Sort) *Pageable

func (*Pageable) GetOffset

func (p *Pageable) GetOffset() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL