ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.
(opts ...sql.LockOption)
| 620 | // on any rows that are read. Other sessions can read the rows, but cannot modify them |
| 621 | // until your transaction commits. |
| 622 | func (_q *UserQuery) ForShare(opts ...sql.LockOption) *UserQuery { |
| 623 | if _q.driver.Dialect() == dialect.Postgres { |
| 624 | _q.Unique(false) |
| 625 | } |
| 626 | _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { |
| 627 | s.ForShare(opts...) |
| 628 | }) |
| 629 | return _q |
| 630 | } |
| 631 | |
| 632 | // Modify adds a query modifier for attaching custom logic to queries. |
| 633 | func (_q *UserQuery) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { |