You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/adapter-sql-js/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,9 @@
3
3
A development package for PowerSync which uses [SQL.js](https://sql.js.org/#/) to provide a pure JavaScript SQLite implementation.
4
4
This eliminates the need for native dependencies and enables seamless development with Expo Go and other JavaScript-only environments.
5
5
6
-
This adapter is specifically intended to streamline the development workflow and will be much slower than DB adapters that use native dependencies.
6
+
This adapter is specifically intended to streamline the **development workflow** and will be much slower than DB adapters that use native dependencies.
7
7
Every write operation triggers a complete rewrite of the entire database file to persistent storage, not just the changed data.
8
-
In addition to the perfomance overheads, this adapter doesn't provide any of the SQLite consistency guarantees - you may end up with missing data or a corrupted database file if the app is killed while writing to the database file.
8
+
In addition to the performance overheads, this adapter doesn't provide any of the SQLite consistency guarantees - you may end up with missing data or a corrupted database file if the app is killed while writing to the database file.
9
9
10
10
For production use, when building React Native apps we recommend switching to our [react-native-quick-sqlite](https://www.npmjs.com/package/@journeyapps/react-native-quick-sqlite) or [OP-SQLite](https://www.npmjs.com/package/@powersync/op-sqlite) adapters when making production builds as they give substantially better performance.
* Returns an async iterator of completed transactions with local writes against the database.
656
+
*
657
+
* This is typically used from the {@link PowerSyncBackendConnector.uploadData} callback. Each entry emitted by the
658
+
* returned iterator is a full transaction containing all local writes made while that transaction was active.
659
+
*
660
+
* Unlike {@link getNextCrudTransaction}, which always returns the oldest transaction that hasn't been
661
+
* {@link CrudTransaction.complete}d yet, this iterator can be used to receive multiple transactions. Calling
662
+
* {@link CrudTransaction.complete} will mark that and all prior transactions emitted by the iterator as completed.
663
+
*
664
+
* This can be used to upload multiple transactions in a single batch, e.g with:
665
+
*
666
+
* ```JavaScript
667
+
* let lastTransaction = null;
668
+
* let batch = [];
669
+
*
670
+
* for await (const transaction of database.getCrudTransactions()) {
671
+
* batch.push(...transaction.crud);
672
+
* lastTransaction = transaction;
673
+
*
674
+
* if (batch.length > 10) {
675
+
* break;
676
+
* }
677
+
* }
678
+
* ```
679
+
*
680
+
* If there is no local data to upload, the async iterator complete without emitting any items.
681
+
*
682
+
* Note that iterating over async iterables requires a [polyfill](https://github.com/powersync-ja/powersync-js/tree/main/packages/react-native#babel-plugins-watched-queries)
0 commit comments