- Core API Reference
- Collection
- createCollection
- liveQueryCollectionOptions
- createLiveQueryCollection
- createOptimisticAction
- createTransaction
- Electric DB Collection
- electricCollectionOptions
- Query DB Collection
- queryCollectionOptions
- RxDB DB Collection
- rxdbCollectionOptions
- PowerSync Collection
- powerSyncCollectionOptions
- createIndexedDB
- indexedDBCollectionOptions
- React Hooks
- useLiveQuery
QueryIR
Defined in: packages/db/src/query/ir.ts:16
Properties#
distinct?#
optional distinct?: true;Defined in: packages/db/src/query/ir.ts:28
fnHaving?#
optional fnHaving?: ((row) => any)[];Defined in: packages/db/src/query/ir.ts:34
Parameters#
row#
Returns#
any
fnSelect?#
optional fnSelect?: (row) => any;Defined in: packages/db/src/query/ir.ts:32
Parameters#
row#
Returns#
any
fnWhere?#
optional fnWhere?: ((row) => any)[];Defined in: packages/db/src/query/ir.ts:33
Parameters#
row#
Returns#
any
from#
from: From;Defined in: packages/db/src/query/ir.ts:17
groupBy?#
optional groupBy?: GroupBy;Defined in: packages/db/src/query/ir.ts:21
grouping?#
optional grouping?: object;Defined in: packages/db/src/query/ir.ts:23
processGroupBy#
processGroupBy: (pipeline, groupByClause, valueIdentity, isSourceRef, havingClauses?, selectClause?, fnHavingClauses?, mainSource?, sanitizeCallbackRows) => NamespacedAndKeyedStream;Processes the GROUP BY clause with optional HAVING and SELECT Works with the new $selected structure from early SELECT processing
Parameters#
pipeline#
groupByClause#
valueIdentity#
ValueIdentity
isSourceRef#
(ref) => boolean
Whether a ref reads a field of the query's own rows.
havingClauses?#
Where[]
selectClause?#
fnHavingClauses?#
((row) => any)[]
mainSource?#
string
sanitizeCallbackRows?#
boolean = false
Returns#
replaceAggregatesByRefs#
replaceAggregatesByRefs: (havingExpr, selectClause, resultAlias) => BasicExpression;Transforms expressions to replace aggregate functions with references to computed values.
For aggregate expressions, finds matching aggregates in the SELECT clause and replaces them with PropRef([resultAlias, alias]) to reference the computed aggregate value.
Ref expressions (table columns and $selected fields) and value expressions are passed through unchanged. Function expressions are recursively transformed.
Parameters#
havingExpr#
| Aggregate<any> | BasicExpression
The expression to transform (can be aggregate, ref, func, or val)
selectClause#
The SELECT clause containing aliases and aggregate definitions
resultAlias?#
string = ...
The namespace alias for SELECT results (default: '$selected')
Returns#
A transformed BasicExpression that references computed values instead of raw expressions
having?#
optional having?: Where[];Defined in: packages/db/src/query/ir.ts:24
join?#
optional join?: Join;Defined in: packages/db/src/query/ir.ts:19
limit?#
optional limit?: number;Defined in: packages/db/src/query/ir.ts:26
offset?#
optional offset?: number;Defined in: packages/db/src/query/ir.ts:27
orderBy?#
optional orderBy?: OrderBy;Defined in: packages/db/src/query/ir.ts:25
select?#
optional select?: Select;Defined in: packages/db/src/query/ir.ts:18
singleResult?#
optional singleResult?: true;Defined in: packages/db/src/query/ir.ts:29
where?#
optional where?: Where[];Defined in: packages/db/src/query/ir.ts:20