For sets the lock configuration for suffixing the `SELECT` statement with the `FOR [SHARE | UPDATE] ...` clause.
(l LockStrength, opts ...LockOption)
| 2363 | // For sets the lock configuration for suffixing the `SELECT` |
| 2364 | // statement with the `FOR [SHARE | UPDATE] ...` clause. |
| 2365 | func (s *Selector) For(l LockStrength, opts ...LockOption) *Selector { |
| 2366 | if s.Dialect() == dialect.SQLite { |
| 2367 | s.AddError(errors.New("sql: SELECT .. FOR UPDATE/SHARE not supported in SQLite")) |
| 2368 | } |
| 2369 | s.lock = &LockOptions{Strength: l} |
| 2370 | for _, opt := range opts { |
| 2371 | opt(s.lock) |
| 2372 | } |
| 2373 | return s |
| 2374 | } |
| 2375 | |
| 2376 | // ForShare sets the lock configuration for suffixing the |
| 2377 | // `SELECT` statement with the `FOR SHARE` clause. |