fix: pagination bug.

This commit is contained in:
tx7do
2023-10-28 20:14:31 +08:00
parent 82fbdc15d9
commit 9990fa43e0
4 changed files with 10 additions and 11 deletions

View File

@@ -17,6 +17,13 @@ func BuildPaginationSelector(page, pageSize int32, noPaging bool) func(*sql.Sele
}
func BuildPaginationSelect(s *sql.Selector, page, pageSize int32) {
if page < 1 {
page = paging.DefaultPage
}
if pageSize < 1 {
pageSize = paging.DefaultPageSize
}
offset := paging.GetPageOffset(page, pageSize)
s.Offset(offset).Limit(int(pageSize))
}