added calculation func for total pages

main v1.0.14
alex 2023-10-13 16:12:53 +02:00
parent 50936924cb
commit 9ba51167b8
1 changed files with 5 additions and 1 deletions

View File

@ -20,7 +20,11 @@ func GetTotalPages(database *gorm.DB, paginationLimit int, any interface{}, wher
Count(&totalPages)
}
return int(math.Ceil(float64(totalPages) / float64(paginationLimit)))
return CalculateTotalPages(int(totalPages), paginationLimit)
}
func CalculateTotalPages(totalItems int, paginationLimit int) int {
return int(math.Ceil(float64(totalItems) / float64(paginationLimit)))
}
func GetPageOffset(page int, paginationLimit int) int {