page

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecAll

func ExecAll(db *xorm.Session, query Query, bean interface{}) (err error)

ExecAll 不分页查询多条

func ExecOne

func ExecOne(db *xorm.Session, query Query, bean interface{}) (has bool, err error)

ExecOne 动态查询获取一条数据

Types

type Params

type Params struct {
	Page  int    `json:"page" form:"page"`
	Limit int    `json:"limit" form:"limit"`
	Sort  string `json:"sort" form:"sort"`
	Order string `json:"order" form:"order"`
}

Params 分页参数

func (*Params) GetOrder

func (p *Params) GetOrder() string

GetOrder 获取排序

func (*Params) GetPageIndex

func (p *Params) GetPageIndex() int

GetPageIndex 获取当前页码

func (*Params) GetPageSize

func (p *Params) GetPageSize() int

GetPageSize 获取分页大小

type Query

type Query interface {
	GetPageIndex() int
	GetPageSize() int
	Build() builder.Cond
	GetOrder() string
}

Info 分页查询条件

type Result

type Result struct {
	Records interface{} `json:"records"`
	Current int         `json:"current"`
	Pages   int         `json:"pages"`
	Size    int         `json:"size"`
	Total   int         `json:"total"`
}

Data 分页结果

func Execute

func Execute(db *xorm.Session, query Query, bean interface{}) (*Result, error)

Execute 分页查询

func NewResult

func NewResult(page, limit, total int) *Result

func (*Result) WithRecords

func (r *Result) WithRecords(data interface{}) *Result

Jump to

Keyboard shortcuts

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