|
@@ -101,7 +101,7 @@ func CheckFieldsForUpdate(object Object, fieldMap map[string]string) error {
|
|
func Check(object Object, fieldMap map[string]string) error {
|
|
func Check(object Object, fieldMap map[string]string) error {
|
|
err := check.Struct(object, fieldMap).CheckWhen("")
|
|
err := check.Struct(object, fieldMap).CheckWhen("")
|
|
if err != nil {
|
|
if err != nil {
|
|
- return errors.New(object.DomainCNName() + ":\n" + err.Error())
|
|
|
|
|
|
+ return errors.New(object.DomainCNName() + ": " + err.Error())
|
|
}
|
|
}
|
|
|
|
|
|
return nil
|
|
return nil
|
|
@@ -123,7 +123,7 @@ func CheckField(object Object, fieldName string, fieldMap map[string]string) err
|
|
return false
|
|
return false
|
|
})
|
|
})
|
|
if err != nil {
|
|
if err != nil {
|
|
- return errors.New(object.DomainCNName() + ":\n" + err.Error())
|
|
|
|
|
|
+ return errors.New(object.DomainCNName() + ": " + err.Error())
|
|
}
|
|
}
|
|
|
|
|
|
return nil
|
|
return nil
|
|
@@ -139,7 +139,7 @@ func CheckField(object Object, fieldName string, fieldMap map[string]string) err
|
|
func CheckFields(object Object, fieldMap map[string]string, checkFunc func(fieldName string) bool) error {
|
|
func CheckFields(object Object, fieldMap map[string]string, checkFunc func(fieldName string) bool) error {
|
|
err := check.Struct(object, fieldMap).CheckFieldWhen("", checkFunc)
|
|
err := check.Struct(object, fieldMap).CheckFieldWhen("", checkFunc)
|
|
if err != nil {
|
|
if err != nil {
|
|
- return errors.New(object.DomainCNName() + ":\n" + err.Error())
|
|
|
|
|
|
+ return errors.New(object.DomainCNName() + ": " + err.Error())
|
|
}
|
|
}
|
|
|
|
|
|
return nil
|
|
return nil
|
|
@@ -155,7 +155,7 @@ func CheckFields(object Object, fieldMap map[string]string, checkFunc func(field
|
|
func CheckWhen(object Object, fieldMap map[string]string, when string) error {
|
|
func CheckWhen(object Object, fieldMap map[string]string, when string) error {
|
|
err := check.Struct(object, fieldMap).CheckWhen(when)
|
|
err := check.Struct(object, fieldMap).CheckWhen(when)
|
|
if err != nil {
|
|
if err != nil {
|
|
- return errors.New(object.DomainCNName() + ":\n" + err.Error())
|
|
|
|
|
|
+ return errors.New(object.DomainCNName() + ": " + err.Error())
|
|
}
|
|
}
|
|
|
|
|
|
return nil
|
|
return nil
|
|
@@ -170,8 +170,8 @@ func CheckWhen(object Object, fieldMap map[string]string, when string) error {
|
|
// 返回值:
|
|
// 返回值:
|
|
// - 错误
|
|
// - 错误
|
|
func CheckFieldWhen(object Object, fieldName string, fieldMap map[string]string, when string) error {
|
|
func CheckFieldWhen(object Object, fieldName string, fieldMap map[string]string, when string) error {
|
|
- err := check.Struct(object, fieldMap).CheckFieldWhen(when, func(fieldName string) bool {
|
|
|
|
- if fieldName == fieldName {
|
|
|
|
|
|
+ err := check.Struct(object, fieldMap).CheckFieldWhen(when, func(fn string) bool {
|
|
|
|
+ if fieldName == fn {
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
|
|
|
|
@@ -195,7 +195,7 @@ func CheckFieldWhen(object Object, fieldName string, fieldMap map[string]string,
|
|
func CheckFieldsWhen(object Object, fieldMap map[string]string, when string, checkFunc func(fieldName string) bool) error {
|
|
func CheckFieldsWhen(object Object, fieldMap map[string]string, when string, checkFunc func(fieldName string) bool) error {
|
|
err := check.Struct(object, fieldMap).CheckFieldWhen(when, checkFunc)
|
|
err := check.Struct(object, fieldMap).CheckFieldWhen(when, checkFunc)
|
|
if err != nil {
|
|
if err != nil {
|
|
- return errors.New(object.DomainCNName() + ":\n" + err.Error())
|
|
|
|
|
|
+ return errors.New(object.DomainCNName() + ": " + err.Error())
|
|
}
|
|
}
|
|
|
|
|
|
return nil
|
|
return nil
|