update_project_module.go
1021 字节
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
package command
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type UpdateProjectModuleCommand struct {
// 项目编号
ProjectModuleId int64 `json:"projectModuleId" valid:"Required"`
// 项目名称
ProjectName string `json:"projectName" valid:"Required"`
// 项目唯一键值
ProjectKey string `json:"projectKey" valid:"Required"`
// 描述信息
Description string `json:"description" valid:"Required"`
// 状态 1:正常 2:删除
Status int `json:"status" valid:"Required"`
}
func (updateProjectModuleCommand *UpdateProjectModuleCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (updateProjectModuleCommand *UpdateProjectModuleCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(updateProjectModuleCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}