gorm-paginate

module
v0.0.0-...-50a9acb Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: MIT

README

gorm-paginate

Gorm Pagination

Usage && 使用方式

go get github.com/ifconfigure/gorm-paginate

Example && 例子
// 1、Chaining - 链式操作查询
userLikesTx := db.Model(UserLikes{}).
    Order("created_at desc").
    Where("to_user_id = ?", toUserID).
    Preload("User.Country")

//2、use paginate - 调用分页类
res, err := paginage.Paginate(userLikesTx, int(currentPage), &userLikes)

if err != nil {
    fmt.Println(err)
    return
}

3、output - 输出
c.JSON(200 ,res)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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