2022-11-28 13:45:25 +08:00
|
|
|
package model
|
2022-06-26 19:09:28 +08:00
|
|
|
|
|
|
|
type PageReq struct {
|
2022-08-27 23:07:48 +08:00
|
|
|
Page int `json:"page" form:"page"`
|
|
|
|
PerPage int `json:"per_page" form:"per_page"`
|
2022-06-26 19:09:28 +08:00
|
|
|
}
|
2022-06-27 19:51:23 +08:00
|
|
|
|
2022-07-12 18:41:16 +08:00
|
|
|
const MaxUint = ^uint(0)
|
|
|
|
const MinUint = 0
|
|
|
|
const MaxInt = int(MaxUint >> 1)
|
|
|
|
const MinInt = -MaxInt - 1
|
|
|
|
|
2022-06-27 19:51:23 +08:00
|
|
|
func (p *PageReq) Validate() {
|
2022-08-14 23:46:30 +08:00
|
|
|
if p.Page < 1 {
|
|
|
|
p.Page = 1
|
2022-06-27 19:51:23 +08:00
|
|
|
}
|
2022-08-14 23:46:30 +08:00
|
|
|
if p.PerPage < 1 {
|
|
|
|
p.PerPage = MaxInt
|
2022-06-27 19:51:23 +08:00
|
|
|
}
|
|
|
|
}
|