update_client_version.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"
"github.com/tiptok/godevp/pkg/domain"
"github.com/astaxie/beego/validation"
)
type UpdateClientVersionCommand struct {
// dcc
Id int64 `json:"id" valid:"Required"`
// 提交人
Commiter string `json:"commiter,omitempty"`
// 项目名称
ProjectName string `json:"projectName,omitempty"`
// 版本号
Version string `json:"version,omitempty"`
// 标题
Title string `json:"title,omitempty"`
// 其他备注信息
Remark string `json:"remark,omitempty"`
// 客户端安装包信息
ClientPackageInfo []*domain.ClientPackageInfo `json:"clientPackageInfo,omitempty"`
}
func (updateClientVersionCommand *UpdateClientVersionCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (updateClientVersionCommand *UpdateClientVersionCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(updateClientVersionCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}