chore: fix typo
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ func ListMetas(c *gin.Context) {
|
||||
common.ErrorResp(c, err, 400)
|
||||
return
|
||||
}
|
||||
req.Validate()
|
||||
log.Debugf("%+v", req)
|
||||
metas, total, err := db.GetMetas(req.PageIndex, req.PageSize)
|
||||
if err != nil {
|
||||
|
@ -17,6 +17,7 @@ func ListStorages(c *gin.Context) {
|
||||
common.ErrorResp(c, err, 400)
|
||||
return
|
||||
}
|
||||
req.Validate()
|
||||
log.Debugf("%+v", req)
|
||||
storages, total, err := db.GetStorages(req.PageIndex, req.PageSize)
|
||||
if err != nil {
|
@ -16,6 +16,7 @@ func ListUsers(c *gin.Context) {
|
||||
common.ErrorResp(c, err, 400)
|
||||
return
|
||||
}
|
||||
req.Validate()
|
||||
log.Debugf("%+v", req)
|
||||
users, total, err := db.GetUsers(req.PageIndex, req.PageSize)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user