forked from mirror/gorm
fix: update omit (#5699)
This commit is contained in:
parent
edb00c10ad
commit
490625981a
|
@ -70,11 +70,13 @@ func Update(config *Config) func(db *gorm.DB) {
|
|||
if db.Statement.SQL.Len() == 0 {
|
||||
db.Statement.SQL.Grow(180)
|
||||
db.Statement.AddClauseIfNotExists(clause.Update{})
|
||||
if _, ok := db.Statement.Clauses["SET"]; !ok {
|
||||
if set := ConvertToAssignments(db.Statement); len(set) != 0 {
|
||||
db.Statement.AddClause(set)
|
||||
} else if _, ok := db.Statement.Clauses["SET"]; !ok {
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
db.Statement.Build(db.Statement.BuildClauses...)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue