pagination

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2019 License: Apache-2.0, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

尝试用通用的分页功能来实现vue组件的数据交互 未完成

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultCurrent         uint64 = 1
	DefaultPageSize        uint64 = 20
	DefaultPageSizeOptions        = []string{"10", "20", "50", "100"}
)

Functions

This section is empty.

Types

type Form

type Form struct {
	Current  uint64 `form:"current" json:"current"`   // 当前页数	number	-
	PageSize uint64 `form:"pageSize" json:"pageSize"` // 每页条数	number	-
}

PaginationForm 用于从表单接收数据,但是不可向下游使用此结构体需转换为安全的 Pagination

func (Form) New

func (f Form) New() *Pagination

type Pagination

type Pagination struct {
	// contains filtered or unexported fields
}

func New

func New(current uint64, pageSize uint64) *Pagination

func (*Pagination) Current

func (p *Pagination) Current() uint64

func (*Pagination) Offset

func (p *Pagination) Offset() uint64

func (*Pagination) PageSize

func (p *Pagination) PageSize() uint64

type RetAPI

type RetAPI struct {
	Total uint64 `json:"total"`
}

RetAPI 这个结构体用于 api 统一返回时增加分页相关的字段

Jump to

Keyboard shortcuts

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