get_advanced_setting_query.go
656 字节
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
)
type GetAdvancedSettingQuery struct {
//操作人
//操作人
//Operator domain.Operator `json:"-"`
Model string `json:"model"`
}
func (q *GetAdvancedSettingQuery) Valid(validation *validation.Validation) {
if len(q.Model) == 0 {
validation.Error("模型名称不能为空")
}
}
func (q *GetAdvancedSettingQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(q)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}