mirror of https://github.com/go-gorm/gorm.git
feat(update): update when has SET clause
This commit is contained in:
parent
5daa413f41
commit
33bc56cbb5
|
@ -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...)
|
||||||
|
|
Loading…
Reference in New Issue