Fix double pointer for where conditions, close #4159

This commit is contained in:
Jinzhu 2021-03-10 19:46:59 +08:00
parent 14b9bd163c
commit 9fccb17d07
1 changed files with 4 additions and 0 deletions

View File

@ -339,6 +339,10 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []
} }
default: default:
reflectValue := reflect.Indirect(reflect.ValueOf(arg)) reflectValue := reflect.Indirect(reflect.ValueOf(arg))
for reflectValue.Kind() == reflect.Ptr {
reflectValue = reflectValue.Elem()
}
if s, err := schema.Parse(arg, stmt.DB.cacheStore, stmt.DB.NamingStrategy); err == nil { if s, err := schema.Parse(arg, stmt.DB.cacheStore, stmt.DB.NamingStrategy); err == nil {
selectedColumns := map[string]bool{} selectedColumns := map[string]bool{}
if idx == 0 { if idx == 0 {