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)
| 546 | // on any rows that are read. Other sessions can read the rows, but cannot modify them |
| 547 | // until your transaction commits. |
| 548 | func (gcq *GitCommitQuery) ForShare(opts ...sql.LockOption) *GitCommitQuery { |
| 549 | if gcq.driver.Dialect() == dialect.Postgres { |
| 550 | gcq.Unique(false) |
| 551 | } |
| 552 | gcq.modifiers = append(gcq.modifiers, func(s *sql.Selector) { |
| 553 | s.ForShare(opts...) |
| 554 | }) |
| 555 | return gcq |
| 556 | } |
| 557 | |
| 558 | // Modify adds a query modifier for attaching custom logic to queries. |
| 559 | func (gcq *GitCommitQuery) Modify(modifiers ...func(s *sql.Selector)) *GitCommitSelect { |