CasaOS/model/req.go

24 lines
378 B
Go
Raw Normal View History

2023-01-16 05:54:44 +00:00
package model
type PageReq struct {
2023-02-02 15:59:33 +00:00
Index int `json:"page" form:"index"`
Size int `json:"size" form:"size"`
2023-01-16 05:54:44 +00:00
}
const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1
func (p *PageReq) Validate() {
2023-02-02 15:59:33 +00:00
if p.Index < 1 {
p.Index = 1
2023-01-16 05:54:44 +00:00
}
2023-02-02 15:59:33 +00:00
if p.Size < 1 {
p.Size = 100000
2023-01-16 05:54:44 +00:00
}
2023-02-02 15:59:33 +00:00
// if p.PerPage < 1 {
// p.PerPage = MaxInt
// }
2023-01-16 05:54:44 +00:00
}