page

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data[T any] struct {
	Total int64 `json:"total"` // 总页数
	List  []T   `json:"list"`  // 列表数据
}

Data 分页数据响应体 T 列表每一项的数据类型

func New

func New[T any](total int64, list ...T) *Data[T]

type DataMeta

type DataMeta[T any, M any] struct {
	Data[T]
	Meta M `json:"meta"`
}

DataMeta 分页数据响应体(携带额外数据) T 列表每一项的数据类型 M 非列表数据的数据类型

type Query

type Query struct {
	// 当前数据是第几页
	// 1. PageNum = 0 -> PageNum = 1
	// 2. PageNum < 0 -> PageNum = -1 (不分页)
	PageNum int `json:"pageNum" form:"pageNum"`
	// 每一页多少条数据
	PageSize int `json:"pageSize" form:"pageSize"`
}

Query 分页请求的基类

func NewNot

func NewNot() Query

NewNot 分页接口查询所有(不分页)

func NewQuery

func NewQuery(pageNum, pageSize int) Query

func (Query) Limit

func (r Query) Limit() int

func (Query) Offset

func (r Query) Offset() int

Jump to

Keyboard shortcuts

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