MCPcopy
hub / github.com/ent/ent / For

Method For

dialect/sql/builder.go:2365–2374  ·  view source on GitHub ↗

For sets the lock configuration for suffixing the `SELECT` statement with the `FOR [SHARE | UPDATE] ...` clause.

(l LockStrength, opts ...LockOption)

Source from the content-addressed store, hash-verified

2363// For sets the lock configuration for suffixing the `SELECT`
2364// statement with the `FOR [SHARE | UPDATE] ...` clause.
2365func (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.

Callers 2

ForShareMethod · 0.95
ForUpdateMethod · 0.95

Calls 3

NewMethod · 0.80
DialectMethod · 0.65
AddErrorMethod · 0.45

Tested by

no test coverage detected