req.go 378 B

1234567891011121314151617181920212223
  1. package model
  2. type PageReq struct {
  3. Index int `json:"page" form:"index"`
  4. Size int `json:"size" form:"size"`
  5. }
  6. const MaxUint = ^uint(0)
  7. const MinUint = 0
  8. const MaxInt = int(MaxUint >> 1)
  9. const MinInt = -MaxInt - 1
  10. func (p *PageReq) Validate() {
  11. if p.Index < 1 {
  12. p.Index = 1
  13. }
  14. if p.Size < 1 {
  15. p.Size = 100000
  16. }
  17. // if p.PerPage < 1 {
  18. // p.PerPage = MaxInt
  19. // }
  20. }