mirror of https://github.com/go-gorm/gorm.git
fix: update omit (#5699)
This commit is contained in:
parent
edb00c10ad
commit
490625981a
|
@ -70,10 +70,12 @@ 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 set := ConvertToAssignments(db.Statement); len(set) != 0 {
|
||||
db.Statement.AddClause(set)
|
||||
} else if _, ok := db.Statement.Clauses["SET"]; !ok {
|
||||
return
|
||||
if _, ok := db.Statement.Clauses["SET"]; !ok {
|
||||
if set := ConvertToAssignments(db.Statement); len(set) != 0 {
|
||||
db.Statement.AddClause(set)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
db.Statement.Build(db.Statement.BuildClauses...)
|
||||
|
|
Loading…
Reference in New Issue