import_data_command.go
735 字节
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"io"
)
type ImportDataCommand struct {
//操作人
Operator domain.Operator `json:"-"`
Reader io.Reader `json:"-"`
// 业务编码
Code string `form:"code"`
}
func (importDataCommand *ImportDataCommand) Valid(validation *validation.Validation) {
}
func (importDataCommand *ImportDataCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(importDataCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}