Skip to content

Commit c3e7c93

Browse files
committed
rename stuff
1 parent d9b2014 commit c3e7c93

File tree

6 files changed

+152
-134
lines changed

6 files changed

+152
-134
lines changed

packages/db/src/query/compiler/index.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function compileQuery(
5858
collections: Record<string, Collection<any, any, any, any, any>>,
5959
subscriptions: Record<string, CollectionSubscription>,
6060
callbacks: Record<string, LazyCollectionCallbacks>,
61-
lazyCollections: Set<string>,
61+
lazySources: Set<string>,
6262
optimizableOrderByCollections: Record<string, OrderByOptimizationInfo>,
6363
cache: QueryCache = new WeakMap(),
6464
queryMapping: QueryMapping = new WeakMap()
@@ -83,13 +83,13 @@ export function compileQuery(
8383
// the live layer can subscribe to every alias the optimizer introduces.
8484
const aliasToCollectionId: Record<string, string> = {}
8585

86-
// Create a map of table aliases to inputs
86+
// Create a map of source aliases to input streams
8787
// Note: alias keys take precedence over collection keys for input resolution
88-
const tables: Record<string, KeyedStream> = {}
88+
const sources: Record<string, KeyedStream> = {}
8989

90-
// Process the FROM clause to get the main table
90+
// Process the FROM clause to get the main source
9191
const {
92-
alias: mainTableAlias,
92+
alias: mainSource,
9393
input: mainInput,
9494
collectionId: mainCollectionId,
9595
} = processFrom(
@@ -98,19 +98,19 @@ export function compileQuery(
9898
collections,
9999
subscriptions,
100100
callbacks,
101-
lazyCollections,
101+
lazySources,
102102
optimizableOrderByCollections,
103103
cache,
104104
queryMapping,
105105
aliasToCollectionId
106106
)
107-
tables[mainTableAlias] = mainInput
107+
sources[mainSource] = mainInput
108108

109-
// Prepare the initial pipeline with the main table wrapped in its alias
109+
// Prepare the initial pipeline with the main source wrapped in its alias
110110
let pipeline: NamespacedAndKeyedStream = mainInput.pipe(
111111
map(([key, row]) => {
112112
// Initialize the record with a nested structure
113-
const ret = [key, { [mainTableAlias]: row }] as [
113+
const ret = [key, { [mainSource]: row }] as [
114114
string,
115115
Record<string, typeof row>,
116116
]
@@ -123,16 +123,16 @@ export function compileQuery(
123123
pipeline = processJoins(
124124
pipeline,
125125
query.join,
126-
tables,
126+
sources,
127127
mainCollectionId,
128-
mainTableAlias,
128+
mainSource,
129129
allInputs,
130130
cache,
131131
queryMapping,
132132
collections,
133133
subscriptions,
134134
callbacks,
135-
lazyCollections,
135+
lazySources,
136136
optimizableOrderByCollections,
137137
rawQuery,
138138
compileQuery,
@@ -193,7 +193,7 @@ export function compileQuery(
193193
map(([key, namespacedRow]) => {
194194
const selectResults =
195195
!query.join && !query.groupBy
196-
? namespacedRow[mainTableAlias]
196+
? namespacedRow[mainSource]
197197
: namespacedRow
198198

199199
return [
@@ -340,7 +340,7 @@ function processFrom(
340340
collections: Record<string, Collection>,
341341
subscriptions: Record<string, CollectionSubscription>,
342342
callbacks: Record<string, LazyCollectionCallbacks>,
343-
lazyCollections: Set<string>,
343+
lazySources: Set<string>,
344344
optimizableOrderByCollections: Record<string, OrderByOptimizationInfo>,
345345
cache: QueryCache,
346346
queryMapping: QueryMapping,
@@ -370,7 +370,7 @@ function processFrom(
370370
collections,
371371
subscriptions,
372372
callbacks,
373-
lazyCollections,
373+
lazySources,
374374
optimizableOrderByCollections,
375375
cache,
376376
queryMapping

0 commit comments

Comments
 (0)