cursor

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

游标分页组件

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page struct {
	CursorValue string // 分页游标原始值
	NextTimeAt  int64  // 记录分页发生的时间点, 毫秒时间戳
	PageSize    int    // 分页拉取数量
}

游标信息

func New

func New(cursor string, pageSize int) (*Page, error)

New 解密游标 cursor: string 加密后游标值

func (*Page) Generate

func (p *Page) Generate(total int64, cursorValue string, nextPage int, dataList []map[string]interface{}) (RecordsInfo, error)

Generate 输出格式化的分页信息 total: int64 记录总数 cursorValue: string 原始游标值 nextPage: int 下一页状态 dataList: []map[string]interface{} 查询结果集

type PageInfo

type PageInfo struct {
	Total      int64                    `json:"total" xml:"total"`           // 数据总数
	List       []map[string]interface{} `json:"list" xml:"list"`             // 分页数据
	NextPage   int                      `json:"nextPage" xml:"nextPage"`     // 是否还有下一页
	NextCursor string                   `json:"nextCursor" xml:"nextCursor"` // 下一页请求游标
}

分页数据结果

type RecordsInfo

type RecordsInfo struct {
	Records PageInfo `json:"records" xml:"records"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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