From 9fccb17d076a6dafd0bfd3329169e50097d0f2fc Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Wed, 10 Mar 2021 19:46:59 +0800 Subject: [PATCH] Fix double pointer for where conditions, close #4159 --- statement.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/statement.go b/statement.go index 6f336799..3d64d443 100644 --- a/statement.go +++ b/statement.go @@ -339,6 +339,10 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) [] } default: 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 { selectedColumns := map[string]bool{} if idx == 0 {