PowerSyncDatabase
A PowerSync managed database.
Use one instance per database file.
Use PowerSyncDatabase.connect to connect to the PowerSync service, to keep the local database in sync with the remote database.
All changes to local tables are automatically recorded, whether connected or not. Once connected, the changes are uploaded.
Properties
Functions
Close the sync connection.
Disconnect and clear the database. Use this when logging out. The database can still be queried after this is called, but the tables would be empty.
Get a batch of crud data to upload.
Get the next recorded transaction to upload.
Convenience method to get the current version of PowerSync.
Opens a read-only transaction.
Replace the schema with a new version. This is for advanced use cases - typically the schema should just be specified once in the constructor.
Suspend function that resolves when the first sync has occurred
Suspend function that resolves when the first sync covering at least all buckets with the given priority (or a higher one, since those would be synchronized first) has completed.
Executes a read-only (SELECT) query every time the source tables are modified and returns the results as a Flow of lists.
Opens a read-write transaction.