MCPcopy Index your code
hub / github.com/TanStack/db / compileSQLite

Function compileSQLite

packages/powersync-db-collection/src/sqlite-compiler.ts:45–67  ·  view source on GitHub ↗
(
  options: LoadSubsetOptions,
  compileOptions?: CompileSQLiteOptions,
)

Source from the content-addressed store, hash-verified

43 * ```
44 */
45export function compileSQLite(
46 options: LoadSubsetOptions,
47 compileOptions?: CompileSQLiteOptions,
48): SQLiteCompiledQuery {
49 const { where, orderBy, limit } = options
50
51 const params: Array<unknown> = []
52 const result: SQLiteCompiledQuery = { params }
53
54 if (where) {
55 result.where = compileExpression(where, params, compileOptions)
56 }
57
58 if (orderBy) {
59 result.orderBy = compileOrderBy(orderBy, params, compileOptions)
60 }
61
62 if (limit !== undefined) {
63 result.limit = limit
64 }
65
66 return result
67}
68
69/**
70 * Quote SQLite identifiers to handle column names correctly.

Callers 3

loadSubsetFunction · 0.90
unloadSubsetFunction · 0.90

Calls 2

compileExpressionFunction · 0.70
compileOrderByFunction · 0.70

Tested by

no test coverage detected