abstract
AbstractPowerSyncDatabase
Extends
Constructors
new AbstractPowerSyncDatabase(options)
new AbstractPowerSyncDatabase(
options
):AbstractPowerSyncDatabase
Parameters
Parameter | Type |
---|---|
options | PowerSyncDatabaseOptions |
Returns
Overrides
Source
packages/common/src/client/AbstractPowerSyncDatabase.ts:148
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
_isReadyPromise | protected | Promise < void > | - | - |
_schema | protected | Schema < SchemaType > | - | - |
bucketStorageAdapter | protected | BucketStorageAdapter | - | - |
closed | public | boolean | Returns true if the connection is closed. | - |
currentStatus | public | SyncStatus | Current connection status. | - |
hasSyncedWatchDisposer? | private | () => void | - | - |
listeners | protected | Set < Partial < PowerSyncDBListener > > | - | BaseObserver .listeners |
options | protected | PowerSyncDatabaseOptions | - | - |
ready | public | boolean | - | - |
sdkVersion | public | string | - | - |
syncStatusListenerDisposer? | private | () => void | - | - |
syncStreamImplementation? | public | StreamingSyncImplementation | - | - |
transactionMutex | static | Mutex | Transactions should be queued in the DBAdapter, but we also want to prevent calls to .execute while an async transaction is running. | - |
Accessors
connected
get
connected():boolean
Whether a connection to the PowerSync service is currently open.
Returns
boolean
Source
packages/common/src/client/AbstractPowerSyncDatabase.ts:180
database
get
database():DBAdapter
The underlying database.
For the most part, behavior is the same whether querying on the underlying database, or on AbstractPowerSyncDatabase.
Returns
Source
packages/common/src/client/AbstractPowerSyncDatabase.ts:173
schema
get
schema():Schema
<SchemaType
>
Schema used for the local database.
Returns
Schema
< SchemaType
>
Source
packages/common/src/client/AbstractPowerSyncDatabase.ts:164
Methods
_initialize()
abstract
_initialize():Promise
<void
>
Allows for extended implementations to execute custom initialization logic as part of the total init process
Returns
Promise
< void
>
Source
packages/common/src/client/AbstractPowerSyncDatabase.ts:229
close()
close(
options
):Promise
<void
>
Close the database, releasing resources.
Also disconnects any active connection.
Once close is called, this connection cannot be used again - a new one must be constructed.
Parameters
Parameter | Type | Default value |
---|---|---|
options | PowerSyncCloseOptions | DEFAULT_POWERSYNC_CLOSE_OPTIONS |
Returns
Promise
< void
>
Source
packages/common/src/client/AbstractPowerSyncDatabase.ts:402
connect()
connect(
connector
,options
?):Promise
<void
>
Connects to stream of events from the PowerSync instance.
Parameters
Parameter | Type |
---|---|
connector | PowerSyncBackendConnector |
options ? | PowerSyncConnectionOptions |
Returns
Promise
< void
>
Source
packages/common/src/client/AbstractPowerSyncDatabase.ts:317
disconnect()
disconnect():
Promise
<void
>
Close the sync connection.
Use connect to connect again.
Returns
Promise
< void
>
Source
packages/common/src/client/AbstractPowerSyncDatabase.ts:347
disconnectAndClear()
disconnectAndClear(
options
):Promise
<void
>
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.
To preserve data in local-only tables, set clearLocal to false.