compileQuery

Function: compileQuery()

ts
function compileQuery(
   rawQuery, 
   inputs, 
   collections, 
   subscriptions, 
   callbacks, 
   lazySources, 
   optimizableOrderByCollections, 
   setWindowFn, 
   cache, 
   queryMapping): CompilationResult;
function compileQuery(
   rawQuery, 
   inputs, 
   collections, 
   subscriptions, 
   callbacks, 
   lazySources, 
   optimizableOrderByCollections, 
   setWindowFn, 
   cache, 
   queryMapping): CompilationResult;

Defined in: packages/db/src/query/compiler/index.ts:85

Compiles a query IR into a D2 pipeline

Parameters

rawQuery

QueryIR

The query IR to compile

inputs

Record<string, KeyedStream>

Mapping of source aliases to input streams (e.g., { employee: input1, manager: input2 })

collections

Record<string, Collection<any, any, any, any, any>>

Mapping of collection IDs to Collection instances

subscriptions

Record<string, CollectionSubscription>

Mapping of source aliases to CollectionSubscription instances

callbacks

Record<string, LazyCollectionCallbacks>

Mapping of source aliases to lazy loading callbacks

lazySources

Set<string>

Set of source aliases that should load data lazily

optimizableOrderByCollections

Record<string, OrderByOptimizationInfo>

Map of collection IDs to order-by optimization info

setWindowFn

(windowFn) => void

cache

QueryCache = ...

Optional cache for compiled subqueries (used internally for recursion)

queryMapping

QueryMapping = ...

Optional mapping from optimized queries to original queries

Returns

CompilationResult

A CompilationResult with the pipeline, source WHERE clauses, and alias metadata

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.