1 Star 0 Fork 0

窦雪峰 / go-common

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
page.go 624 Bytes
一键复制 编辑 原始数据 按行查看 历史
douxuefeng 提交于 2020-10-13 11:16 . add laspage
/*
@Time : 2020/9/26 12:52
@Author : douxuefeng
@File : page
@Desc:
*/
package go_common
import "math"
type Page struct {
CurrentPage int `json:"current_page"`
Total int64 `json:"total"`
Data interface{} `json:"data"`
PerPage int `json:"per_page"`
LastPage int `json:"last_page"`
}
func LastPage(total int64, pageSize int) int {
return int(math.Ceil(float64(total) / float64(pageSize)))
}
func GetPage(total int64, currentPage,perPage,lastPage int, data interface{} ) *Page {
return &Page{
CurrentPage: currentPage,
Total: total,
Data: data,
PerPage: perPage,
LastPage: lastPage,
}
}
Go
1
https://gitee.com/douxuefeng/go-common.git
git@gitee.com:douxuefeng/go-common.git
douxuefeng
go-common
go-common
dev

搜索帮助