ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.
(opts ...sql.LockOption)
| 607 | // updated, deleted or "selected ... for update" by other sessions, until the transaction is |
| 608 | // either committed or rolled-back. |
| 609 | func (_q *UserQuery) ForUpdate(opts ...sql.LockOption) *UserQuery { |
| 610 | if _q.driver.Dialect() == dialect.Postgres { |
| 611 | _q.Unique(false) |
| 612 | } |
| 613 | _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { |
| 614 | s.ForUpdate(opts...) |
| 615 | }) |
| 616 | return _q |
| 617 | } |
| 618 | |
| 619 | // ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock |
| 620 | // on any rows that are read. Other sessions can read the rows, but cannot modify them |
no test coverage detected