MCPcopy Create free account
hub / github.com/effect-app/libs / wrapRelation

Function wrapRelation

packages/infra/src/Store/SQL/query.ts:335–344  ·  view source on GitHub ↗
(rel: string, inner: string, every: boolean)

Source from the content-addressed store, hash-verified

333 }
334
335 const wrapRelation = (rel: string, inner: string, every: boolean): string => {
336 // Optimize tautological/contradictory conditions
337 if (every && inner === "1=1") return "1=1"
338 if (!every && inner === "1=0") return "1=0"
339 const from = dialect.jsonEachFrom(rel, `_${rel}`)
340 // ∀x.P(x) ≡ ¬∃x.¬P(x), i.e. NOT EXISTS(... WHERE NOT P)
341 return every
342 ? `NOT EXISTS(SELECT 1 FROM ${from} WHERE NOT (${inner}))`
343 : `EXISTS(SELECT 1 FROM ${from} WHERE ${inner})`
344 }
345
346 const print = (state: readonly FilterResult[], isRelation: string | null, every: boolean): string => {
347 let s = ""

Callers 1

printFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…