dao

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPageList

func GetPageList[T any](page *PageRequest, model *gorm.DB, list *response.PageList[T]) (err error)

GetPageList 分页公共方法

func Paginate

func Paginate(p *PageRequest) func(db *gorm.DB) *gorm.DB

Types

type PageRequest

type PageRequest struct {
	Page     int                    // 页码
	PageSize int                    // 每页数量
	Total    int64                  // total 总数
	Where    map[string]interface{} // 条件and 自行拼接
	OrWhere  map[string]interface{} // 条件or 自行拼接
	// contains filtered or unexported fields
}

PageRequest 分页请求的参数

func NewPageReq

func NewPageReq() *PageRequest

NewPageReq 初始化分页请求参数 默认第一页 每页10条

func (*PageRequest) AscSort

func (p *PageRequest) AscSort(field string)

AscSort 正序排序

func (*PageRequest) DescSort

func (p *PageRequest) DescSort(field string)

DescSort 倒序排序

Jump to

Keyboard shortcuts

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