page

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Integer

type Integer interface {
	constraints.Integer
}

Integer 整型类型约束

type Page

type Page[T any, INT Integer] struct {
	PageNo       INT `json:"pageNo"` // 若序列化时想要使用其他的命名风格,建议使用 github.com/json-iterator/go 库中的 extra.SetNamingStrategy() 函数注册自定义命名策略。
	PageSize     INT `json:"pageSize"`
	TotalPages   INT `json:"totalPages"`
	TotalRecords INT `json:"totalRecords"`
	Records      []T `json:"records"`
}

Page 分页结构定义

func EmptyPage

func EmptyPage[T any, INT Integer](pageNo, pageSize INT) *Page[T, INT]

EmptyPage 返回空分页

type Pager

type Pager[T any, INT Integer] interface {
	AddRecords(records ...T)
	BuildDBPage() *db.Page[INT]
	BuildPage() *Page[T, INT]
}

Pager 分页接口

func NewPager

func NewPager[T any, INT Integer](pageNo, pageSize, totalRecords INT) Pager[T, INT]

NewPager 构建一个分页对象

Jump to

Keyboard shortcuts

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