mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 13:23:14 +01:00
18 lines
312 B
Go
18 lines
312 B
Go
package repo
|
|
|
|
type PaginationResult[T any] struct {
|
|
Page int `json:"page"`
|
|
PageSize int `json:"pageSize"`
|
|
Total int `json:"total"`
|
|
Items []T `json:"items"`
|
|
}
|
|
|
|
func calculateOffset(page, pageSize int) int {
|
|
offset := (page - 1) * pageSize
|
|
if offset < 0 {
|
|
return 0
|
|
} else {
|
|
return offset
|
|
}
|
|
}
|