From 38aa424c0f2b6386416823ac59b65dab1549af2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E6=A0=87?= Date: Mon, 16 Jan 2023 13:07:24 +0800 Subject: [PATCH] fix(statement): The primary key type is not int, but string or uuid (#5984) --- statement.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/statement.go b/statement.go index 7bdc1317..ed5c7558 100644 --- a/statement.go +++ b/statement.go @@ -288,11 +288,11 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) [] } // The primary key type is not int, but string or uuid (#5984) - if len(args) == 0 { - return []clause.Expression{clause.IN{Column: clause.PrimaryColumn, Values: []interface{}{s}}} - } + //if len(args) == 0 { + // return []clause.Expression{clause.IN{Column: clause.PrimaryColumn, Values: []interface{}{s}}} + //} - if len(args) > 0 && strings.Contains(s, "?") { + if len(args) == 0 || len(args) > 0 && strings.Contains(s, "?") { // looks like a where condition return []clause.Expression{clause.Expr{SQL: s, Vars: args}} }