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

Function compileExpr

packages/infra/src/Store/Cosmos/query.ts:344–353  ·  view source on GitHub ↗
(expression: ComputedProjectionMathIrExpression)

Source from the content-addressed store, hash-verified

342 const relationAlias = relationPath
343 const relationSource = dottedToAccess(`f.${relationPath}`)
344 const compileExpr = (expression: ComputedProjectionMathIrExpression): string => {
345 switch (expression._tag) {
346 case "field":
347 return dottedToAccess(`${relationAlias}.${expression.field}`)
348 case "mul":
349 return `(${compileExpr(expression.left)} * ${compileExpr(expression.right)})`
350 default:
351 return assertUnreachable(expression)
352 }
353 }
354 const factorExpr = (unitExpr: string, toBase: string, factors: Readonly<Record<string, number>>) => {
355 const entries = Object.entries(factors).filter(([, factor]) => Number.isFinite(factor))
356 return entries.reduceRight<string>(

Callers 1

computedSelectExprFunction · 0.70

Calls 2

assertUnreachableFunction · 0.90
dottedToAccessFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…