mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
dialect/sql: report explicit error when trying to SELECT .. FOR UPDAT… (#1847)
* dialect/sql: report explicit error when trying to SELECT .. FOR UPDATE with sqlite * remove redundant assertion
This commit is contained in:
@@ -2363,6 +2363,9 @@ func WithLockClause(clause string) LockOption {
|
||||
// For sets the lock configuration for suffixing the `SELECT`
|
||||
// statement with the `FOR [SHARE | UPDATE] ...` clause.
|
||||
func (s *Selector) For(l LockStrength, opts ...LockOption) *Selector {
|
||||
if s.Dialect() == dialect.SQLite {
|
||||
s.AddError(errors.New("sql: SELECT .. FOR UPDATE/SHARE not supported in SQLite"))
|
||||
}
|
||||
s.lock = &LockOptions{Strength: l}
|
||||
for _, opt := range opts {
|
||||
opt(s.lock)
|
||||
|
||||
Reference in New Issue
Block a user