add missing file

This commit is contained in:
Daniel Ponte 2024-11-24 00:38:13 -05:00
parent 80c06919f8
commit 0977cd3b1f

View file

@ -0,0 +1,15 @@
package common
type Pagination struct {
Page *int `json:"page"`
PerPage *int `json:"perPage"`
}
func (p Pagination) OffsetPerPage(perPageDefault int) (offset int32, perPage int32) {
page := int32(DefaultIfNilOrZero(p.Page, 1))
perPage = int32(DefaultIfNilOrZero(p.PerPage, perPageDefault))
offset = (page - 1) * perPage
return
}