NotPredicates wraps the generated predicates with NOT. For example, NOT(P), NOT((P1 AND P2)).
(predicates ...P)
| 231 | |
| 232 | // NotPredicates wraps the generated predicates with NOT. For example, NOT(P), NOT((P1 AND P2)). |
| 233 | func 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. |
searching dependent graphs…