Unscoped disables the global scope of soft deletion in a query. By default, GORM uses soft deletion, marking records as "deleted" by setting a timestamp on a specific field (e.g., `deleted_at`). Unscoped allows queries to include records marked as deleted, overriding the soft deletion behavior. Exam
()
| 453 | // db.Unscoped().Find(&users) |
| 454 | // // Retrieves all users, including deleted ones. |
| 455 | func (db *DB) Unscoped() (tx *DB) { |
| 456 | tx = db.getInstance() |
| 457 | tx.Statement.Unscoped = true |
| 458 | return |
| 459 | } |
| 460 | |
| 461 | func (db *DB) Raw(sql string, values ...interface{}) (tx *DB) { |
| 462 | tx = db.getInstance() |