v0.0.301 pagination (page+limit) support in wmo
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 2m11s

This commit is contained in:
2023-11-08 18:30:30 +01:00
parent 3a8baaa6d9
commit 62c9a4e734
10 changed files with 137 additions and 9 deletions

16
pagination/pagination.go Normal file
View File

@@ -0,0 +1,16 @@
package pagination
type Pagination struct {
Page int `json:"page"` // page (first page == 1)
Limit int `json:"limit"` // max-page-size
TotalPages int `json:"totalPages"` // total page-count
TotalItems int `json:"totalItems"` // total items-count
CurrentPageCount int `json:"currntPageCount"` // item-count in current page ( == len(data) )
}
func CalcPaginationTotalPages(totalItems int, limit int) int {
if totalItems == 0 {
return 0
}
return 1 + (totalItems-1)/limit
}