mirror of https://github.com/go-gorm/gorm.git
Add invalid data error when building conditions
This commit is contained in:
parent
00a785cd68
commit
53b3ebdd1d
|
@ -308,7 +308,7 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []
|
|||
}
|
||||
}
|
||||
default:
|
||||
if reflectValue := reflect.Indirect(reflect.ValueOf(arg)); reflectValue.IsValid() {
|
||||
reflectValue := reflect.Indirect(reflect.ValueOf(arg))
|
||||
if s, err := schema.Parse(arg, stmt.DB.cacheStore, stmt.DB.NamingStrategy); err == nil {
|
||||
selectedColumns := map[string]bool{}
|
||||
if idx == 0 {
|
||||
|
@ -354,6 +354,8 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []
|
|||
if restricted {
|
||||
break
|
||||
}
|
||||
} else if !reflectValue.IsValid() {
|
||||
stmt.AddError(ErrInvalidData)
|
||||
} else if len(conds) == 0 {
|
||||
if len(args) == 1 {
|
||||
switch reflectValue.Kind() {
|
||||
|
@ -374,7 +376,6 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return conds
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue