Hi, I have a table with some soft-deleted rows, now I need to ble able to search by ID but including that registers, how can I do it? everything that I tried ignores that rows because they don't have _DeletedAt = null_
Hi, this is documented over the CRUD Delete - http://jinzhu.me/gorm/crud.html#delete
Specifically,
// Find soft deleted records with Unscoped
db.Unscoped().Where("age = 20").Find(&users)
//// SELECT * FROM users WHERE age = 20;
Hope this helps.
Most helpful comment
Hi, this is documented over the CRUD Delete - http://jinzhu.me/gorm/crud.html#delete
Specifically,
Hope this helps.