Package.swift
or Xcode:
PowerSyncDatabase
constructor via the schema
parameter. This schema represents a “view” of the downloaded data. No migrations are required — the schema is applied directly when the PowerSync database is constructed.
The types available are text
, integer
and real
. These should map directly to the values produced by the Sync Rules. If a value doesn’t match, it is cast automatically.
Example:
id
column, as PowerSync will automatically create this.PowerSyncBackendConnector.fetchCredentials
- This is called every couple of minutes and is used to obtain credentials for your app’s backend API. -> See Authentication Setup for instructions on how the credentials should be generated.
PowerSyncBackendConnector.uploadData
- Use this to upload client-side changes to your app backend.
-> See Writing Client Changes for considerations on the app backend implementation.
null
if not found.
get
method executes a read-only (SELECT) query and returns a single result. It throws an exception if no result is found. Use getOptional
to return a single optional result (returns null
if no result is found).
getAll
method executes a read-only (SELECT) query and returns a set of rows.
watch
method executes a read query whenever a change to a dependent table is made.
execute
method executes a write query (INSERT, UPDATE, DELETE) and returns the results (if any).
DefaultLogger
supports the following severity levels: .debug
, .info
, .warn
, .error
.