create_project_module_version.go
901 字节
package command
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type CreateProjectModuleVersionCommand struct {
// 项目编号
ProjectModuleId int64 `json:"projectModuleId" valid:"Required"`
// 唯一标识
Version int64 `json:"version" valid:"Required"`
// 描述信息
Description string `json:"description" valid:"Required"`
}
func (createProjectModuleVersionCommand *CreateProjectModuleVersionCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (createProjectModuleVersionCommand *CreateProjectModuleVersionCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(createProjectModuleVersionCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}