mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
dialect/sql/builder: make sql.NotIn() with empty args fallback to NOT FALSE (#2757)
* dialect/sql/builder: make sql.NotIn() with empty args fallback to False() This is basically the identical change to #2735, but for NotIn(). This bug currently prevents anyone using NotIn() from upgrading from v0.10.x to v0.11.x * Update go.sum untidy * feedback
This commit is contained in:
@@ -1587,8 +1587,10 @@ func NotIn(col string, args ...interface{}) *Predicate {
|
||||
|
||||
// NotIn appends the `Not IN` predicate.
|
||||
func (p *Predicate) NotIn(col string, args ...interface{}) *Predicate {
|
||||
// If no arguments were provided, append the NOT FALSE constant, since
|
||||
// we cannot apply "NOT IN ()". This will make this predicate truthy.
|
||||
if len(args) == 0 {
|
||||
return p
|
||||
return Not(p.False())
|
||||
}
|
||||
return p.Append(func(b *Builder) {
|
||||
b.Ident(col).WriteOp(OpNotIn)
|
||||
|
||||
Reference in New Issue
Block a user