homebox/backend/internal/data/repo/pagination.go
2024-01-25 11:46:29 +00:00

13 lines
292 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"`
TotalPrice float64 `json:"totalPrice"`
}
func calculateOffset(page, pageSize int) int {
return (page - 1) * pageSize
}