update_project_module.go 1021 字节
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
}