Open History to see the last commit
1---
2id: compileExpression
3title: compileExpression
4---
5
6```ts
7function compileExpression(expr, isSingleRow): CompiledSingleRowExpression | CompiledExpression;
8```
9
10Defined in: [packages/db/src/query/compiler/evaluators.ts:103](https://github.com/TanStack/db/blob/main/packages/db/src/query/compiler/evaluators.ts#L103)
11
12Compiles an expression into an optimized evaluator function.
13This eliminates branching during evaluation by pre-compiling the expression structure.
14
15## Parameters
16
17### expr
18
19[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)
20
21### isSingleRow
22
23`boolean` = `false`
24
25## Returns
26
27`CompiledSingleRowExpression` \| `CompiledExpression`