18 lines
481 B
Go
18 lines
481 B
Go
package validator
|
|
|
|
import "lone-services/pkg/validate"
|
|
|
|
type UploadValidator struct {
|
|
Filename string `validate:"required,max=255"`
|
|
Content []byte `validate:"required,min=1"`
|
|
}
|
|
|
|
func (p UploadValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Filename.required": "文件名不能为空",
|
|
"Filename.max": "文件名过长",
|
|
"Content.required": "文件内容不能为空",
|
|
"Content.min": "文件内容不能为空",
|
|
}
|
|
}
|