feat(update): update when has SET clause

This commit is contained in:
riverchu 2021-11-09 19:55:47 +08:00
parent 5daa413f41
commit 33bc56cbb5
1 changed files with 1 additions and 1 deletions

View File

@ -70,7 +70,7 @@ func Update(config *Config) func(db *gorm.DB) {
db.Statement.AddClauseIfNotExists(clause.Update{}) db.Statement.AddClauseIfNotExists(clause.Update{})
if set := ConvertToAssignments(db.Statement); len(set) != 0 { if set := ConvertToAssignments(db.Statement); len(set) != 0 {
db.Statement.AddClause(set) db.Statement.AddClause(set)
} else { } else if _, ok := db.Statement.Clauses["SET"]; !ok {
return return
} }
db.Statement.Build(db.Statement.BuildClauses...) db.Statement.Build(db.Statement.BuildClauses...)