Added comment describing Unscoped() method
This commit is contained in:
parent
9a61ef2af8
commit
6399cc019b
@ -429,6 +429,15 @@ func (db *DB) Assign(attrs ...interface{}) (tx *DB) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
// Example:
|
||||||
|
// var users []User
|
||||||
|
// db.Unscoped().Find(&users)
|
||||||
|
// // Retrieves all users, including deleted ones.
|
||||||
func (db *DB) Unscoped() (tx *DB) {
|
func (db *DB) Unscoped() (tx *DB) {
|
||||||
tx = db.getInstance()
|
tx = db.getInstance()
|
||||||
tx.Statement.Unscoped = true
|
tx.Statement.Unscoped = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user