NotIn appends the `Not IN` predicate.
(col string, args ...any)
| 1105 | |
| 1106 | // NotIn appends the `Not IN` predicate. |
| 1107 | func (p *Predicate) NotIn(col string, args ...any) *Predicate { |
| 1108 | // If no arguments were provided, append the NOT FALSE constant, since |
| 1109 | // we cannot apply "NOT IN ()". This will make this predicate truthy. |
| 1110 | if len(args) == 0 { |
| 1111 | return Not(p.False()) |
| 1112 | } |
| 1113 | return p.Append(func(b *Builder) { |
| 1114 | b.Ident(col).WriteOp(OpNotIn) |
| 1115 | b.Wrap(func(b *Builder) { |
| 1116 | if s, ok := args[0].(*Selector); ok { |
| 1117 | b.Join(s) |
| 1118 | } else { |
| 1119 | b.Args(args...) |
| 1120 | } |
| 1121 | }) |
| 1122 | }) |
| 1123 | } |
| 1124 | |
| 1125 | // Exists returns the `Exists` predicate. |
| 1126 | func Exists(query Querier) *Predicate { |