command_create_project_module_request.go
708 字节
package command
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type CreateProjectModuleRequest struct {
// 项目名称
ProjectName string `json:"projectName,omitempty" valid:"Required"`
// 项目唯一键值
ProjectKey string `json:"projectKey,omitempty" valid:"Required"`
// 项目描述信息
Description string `json:"description,omitempty"`
}
func (CreateProjectModuleRequest *CreateProjectModuleRequest) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(CreateProjectModuleRequest)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}