Assign provide attributes used in [FirstOrCreate] or [FirstOrInit] Assign adds attributes even if the record is found. If using FirstOrCreate, this means that records will be updated even if they are found. // assign an email regardless of if the record is not found db.Where(User{Name: "non_exis
(attrs ...interface{})
| 437 | // [FirstOrCreate]: https://gorm.io/docs/advanced_query.html#FirstOrCreate |
| 438 | // [FirstOrInit]: https://gorm.io/docs/advanced_query.html#FirstOrInit |
| 439 | func (db *DB) Assign(attrs ...interface{}) (tx *DB) { |
| 440 | tx = db.getInstance() |
| 441 | tx.Statement.assigns = attrs |
| 442 | return |
| 443 | } |
| 444 | |
| 445 | // Unscoped disables the global scope of soft deletion in a query. |
| 446 | // By default, GORM uses soft deletion, marking records as "deleted" |