How to update others col and gorm.Modal DeletedAt at the same time? #5917
Unanswered
spencerchang
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Something like that helps you? db.Model(&datamodels.TableA{}).Updates(map[string]interface{}{
"Status": "off",
"DeletedAt": time.Now(),
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For example:
The table struct using gorm.Modal so that DeletedAt field is auto generated.
I want to combine these two sql to one sql update. And the delete is soft deleted so only update gorm.Modal DeletedAt to a time.
db.Model(&datamodels.TableA{}).Update("Status", "off")
db.Delete(&datamodels.TableA{})
Beta Was this translation helpful? Give feedback.
All reactions