50 lines
1.6 KiB
Go
50 lines
1.6 KiB
Go
package validator
|
|
|
|
import "lone-services/pkg/validate"
|
|
|
|
type GroupEditValidator struct {
|
|
Id int64 `form:"id" json:"id" validate:"required"`
|
|
Name string `form:"name" json:"name" validate:"required"`
|
|
Account string `form:"account" json:"account" validate:"required"`
|
|
Password string `form:"password" json:"password"`
|
|
}
|
|
type GroupPasswordValidator struct {
|
|
Id int64 `form:"id" json:"id" validate:"required"`
|
|
Password string `form:"password" json:"password" validate:"required"`
|
|
}
|
|
|
|
func (p GroupEditValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
validate.FieldId: validate.FieldIdValue,
|
|
"Name.required": "小组名称不能为空",
|
|
"Account.required": "账号不能为空",
|
|
}
|
|
}
|
|
|
|
type GroupCreateValidator struct {
|
|
Name string `form:"name" json:"name" validate:"required"`
|
|
Account string `form:"account" json:"account" validate:"required"`
|
|
Password string `form:"password" json:"password" validate:"required"`
|
|
}
|
|
|
|
func (p GroupCreateValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Name.required": "小组名称不能为空",
|
|
"Account.required": "账号不能为空",
|
|
}
|
|
}
|
|
|
|
func (p GroupPasswordValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
validate.FieldId: validate.FieldIdValue,
|
|
"Password.required": "密码不能为空",
|
|
}
|
|
}
|
|
|
|
type GroupItemsValidator struct {
|
|
Page int32 `form:"page" json:"page"`
|
|
Size int32 `form:"size" json:"size"`
|
|
Name string `form:"name" json:"name"`
|
|
Status int32 `form:"status" json:"status"`
|
|
}
|