fix(statement): The primary key type is not int, but string or uuid (#5984)

This commit is contained in:
胡标 2023-01-16 13:24:54 +08:00
parent db0978af99
commit 694cd49df5

View File

@ -287,9 +287,8 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []
return nil return nil
} }
//The primary key type is not int, but string or uuid (#5984)
if len(args) == 0 && (!strings.Contains(s, "?") && !strings.Contains(s, "@")) { if len(args) == 0 && (!strings.Contains(s, "?") && !strings.Contains(s, "@")) {
// if it is a string, then treats it as primary key // The primary key type is not int, but string or uuid (#5984)
return []clause.Expression{clause.IN{Column: clause.PrimaryColumn, Values: []interface{}{s}}} return []clause.Expression{clause.IN{Column: clause.PrimaryColumn, Values: []interface{}{s}}}
} }