Skip to content

Commit fec9d29

Browse files
Merge branch 'main' into tyler/update-quickstart
2 parents 4c7ad25 + 23c4a21 commit fec9d29

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/sdk/src/db_context.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,27 @@ export class SubscriptionBuilder {
121121
subscribe(query_sql: string[]): void {
122122
this.db['subscribe'](query_sql, this.#onApplied, this.#onError);
123123
}
124+
125+
/**
126+
* Subscribes to all rows from all tables.
127+
*
128+
* This method is intended as a convenience
129+
* for applications where client-side memory use and network bandwidth are not concerns.
130+
* Applications where these resources are a constraint
131+
* should register more precise queries via `subscribe`
132+
* in order to replicate only the subset of data which the client needs to function.
133+
*
134+
* This method should not be combined with `subscribe` on the same `DbConnection`.
135+
* A connection may either `subscribe` to particular queries,
136+
* or `subscribeToAllTables`, but not both.
137+
* Attempting to call `subscribe`
138+
* on a `DbConnection` that has previously used `subscribeToAllTables`,
139+
* or vice versa, may misbehave in any number of ways,
140+
* including dropping subscriptions, corrupting the client cache, or throwing errors.
141+
*/
142+
subscribeToAllTables(): void {
143+
this.subscribe(['SELECT * FROM *']);
144+
}
124145
}
125146

126147
/**

0 commit comments

Comments
 (0)