chore: fix typo

This commit is contained in:
Noah Hsu
2022-07-12 18:41:16 +08:00
parent 2bff656f00
commit a16da3b45e
7 changed files with 17 additions and 6 deletions

View File

@ -5,11 +5,16 @@ type PageReq struct {
PageSize int `json:"page_size" form:"page_size"`
}
const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1
func (p *PageReq) Validate() {
if p.PageIndex < 1 {
p.PageIndex = 1
}
if p.PageSize < 1 {
p.PageSize = 50
p.PageSize = MaxInt
}
}