MCPcopy
hub / github.com/ent/ent / NotPredicates

Function NotPredicates

dialect/sql/sql.go:233–249  ·  view source on GitHub ↗

NotPredicates wraps the generated predicates with NOT. For example, NOT(P), NOT((P1 AND P2)).

(predicates ...P)

Source from the content-addressed store, hash-verified

231
232// NotPredicates wraps the generated predicates with NOT. For example, NOT(P), NOT((P1 AND P2)).
233func NotPredicates[P ~func(*Selector)](predicates ...P) func(*Selector) {
234 return func(s *Selector) {
235 s.CollectPredicates()
236 for _, p := range predicates {
237 p(s)
238 }
239 collected := s.CollectedPredicates()
240 s.UncollectedPredicates()
241 switch len(collected) {
242 case 0:
243 case 1:
244 s.Where(Not(collected[0]))
245 default:
246 s.Where(Not(And(collected...)))
247 }
248 }
249}
250
251// ColumnCheck is a function that verifies whether the
252// specified column exists within the given table.

Callers 15

NotFunction · 0.92
NotFunction · 0.92
NotFunction · 0.92
NotFunction · 0.92
NotFunction · 0.92
NotFunction · 0.92
NotFunction · 0.92
NotFunction · 0.92
NotFunction · 0.92
NotFunction · 0.92
NotFunction · 0.92
NotFunction · 0.92

Calls 6

CollectPredicatesMethod · 0.80
CollectedPredicatesMethod · 0.80
UncollectedPredicatesMethod · 0.80
NotFunction · 0.70
AndFunction · 0.70
WhereMethod · 0.65

Tested by 1

TestNotPredicatesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…