From 33bc56cbb5916173c670d28fb7fcf6a2bbd0b185 Mon Sep 17 00:00:00 2001 From: riverchu Date: Tue, 9 Nov 2021 19:55:47 +0800 Subject: [PATCH] feat(update): update when has SET clause --- callbacks/update.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/callbacks/update.go b/callbacks/update.go index 1603a5172..8efc3983a 100644 --- a/callbacks/update.go +++ b/callbacks/update.go @@ -70,7 +70,7 @@ func Update(config *Config) func(db *gorm.DB) { db.Statement.AddClauseIfNotExists(clause.Update{}) if set := ConvertToAssignments(db.Statement); len(set) != 0 { db.Statement.AddClause(set) - } else { + } else if _, ok := db.Statement.Clauses["SET"]; !ok { return } db.Statement.Build(db.Statement.BuildClauses...)