create_column_setting.go
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package command
import (
"fmt"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
"github.com/astaxie/beego/validation"
)
type CreateColumnSettingCommand struct {
// 公司id
CompanyId int `json:"companyId"`
// 用户uid
Uid int64 `json:"uid"`
// 栏目设置描述
Description string `json:"description"`
// 栏目设置关联用户名称
UserName string `json:"userName"`
// 默认栏目设置
Value []domain.Column `json:"value"`
// 无效栏目设置爱
InvalidValue []domain.Column `json:"invalidValue"`
// 模块键值
Key string `json:"key"`
}
//func (createColumnSettingCommand *CreateColumnSettingCommand) Valid(validation *validation.Validation) {
// _ = validation.SetError("CustomValid", "未实现的自定义认证")
//}
func (createColumnSettingCommand *CreateColumnSettingCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(createColumnSettingCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}