MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / ForUpdate

Method ForUpdate

app/controlplane/pkg/data/ent/user_query.go:609–617  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

607// updated, deleted or "selected ... for update" by other sessions, until the transaction is
608// either committed or rolled-back.
609func (_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

Callers 3

SaveMethod · 0.45
CreateMethod · 0.45

Calls 2

UniqueMethod · 0.95
DialectMethod · 0.80

Tested by

no test coverage detected