We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go-gorm/playground#154
value := &Test{Value: "foo"} db.Model(Test{}).Create(&value) value.Value = "bar" db.Model(Test{}).Save(&value) --> Save: WHERE condition required
Bug, or no longer supported to use Model?
db.Save(&value) --> OK
The text was updated successfully, but these errors were encountered:
https://gorm.io/docs/v2_release_note.html#BlockGlobalUpdate
Sorry, something went wrong.
@jinzhu The condition is generated without the .Model(),but you don't require a .Where() before a .Save() so I don't understand how this isn't a bug.
@jinzhu
db.Debug().Model(Test{}).Save(&test) Outputs [0.284ms] [rows:0] UPDATE `tests` SET `id`=1,`value`="test"
db.Debug().Save(&test) Outputs [0.525ms] [rows:0] UPDATE `tests` SET `value`="test" WHERE `id` = 1
Having same problem, wonder if there is a way to do gorm v1-like Save, which is an upsert function.
Save
jinzhu
No branches or pull requests
GORM Playground Link
go-gorm/playground#154
Description
Bug, or no longer supported to use Model?
The text was updated successfully, but these errors were encountered: