Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alist-org
GitHub Repository: alist-org/alist
Path: blob/main/internal/model/req.go
1560 views
1
package model
2
3
type PageReq struct {
4
Page int `json:"page" form:"page"`
5
PerPage int `json:"per_page" form:"per_page"`
6
}
7
8
const MaxUint = ^uint(0)
9
const MinUint = 0
10
const MaxInt = int(MaxUint >> 1)
11
const MinInt = -MaxInt - 1
12
13
func (p *PageReq) Validate() {
14
if p.Page < 1 {
15
p.Page = 1
16
}
17
if p.PerPage < 1 {
18
p.PerPage = MaxInt
19
}
20
}
21
22