增加计算相关

This commit is contained in:
白茶清欢 2022-07-17 15:51:53 +08:00
parent 3cfcad0c65
commit 29b0f171ff
2 changed files with 32 additions and 0 deletions

29
calculate.go Normal file
View File

@ -0,0 +1,29 @@
// Package util ...
//
// Description : util ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2022-07-17 15:49
package util
// calculate 各种计算相关
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:49 2022/7/17
type calculate struct {
}
// GetTotalPage 获取总页码数
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:50 2022/7/17
func (c *calculate) GetTotalPage(total int64, pageSize int64) int64 {
totalPage := total / pageSize
if total%pageSize > 0 {
totalPage++
}
return totalPage
}

View File

@ -28,6 +28,8 @@ var (
URL *ownURL
// Map ...
Map *ownMap
// Calculate ...
Calculate *calculate
)
func init() {
@ -41,4 +43,5 @@ func init() {
Time = &ownTime{}
URL = &ownURL{}
Map = &ownMap{}
Calculate = &calculate{}
}