feat: product item
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package validator
|
||||
|
||||
import (
|
||||
"pkg.local/validate"
|
||||
)
|
||||
|
||||
type ProductItemsValidator struct {
|
||||
Name string `validate:"max=256"`
|
||||
Page uint32 `validate:"omitempty,min=1"`
|
||||
PageSize uint32 `validate:"omitempty,min=1,max=100"`
|
||||
}
|
||||
|
||||
func (p ProductItemsValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Name.max": "产品名长度不能超过256",
|
||||
"Page.min": "页码最小为1",
|
||||
"PageSize.min": "每页数量最小为1",
|
||||
"PageSize.max": "每页数量最大为100",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user