Reference
Embedded Replicas
You can work with embedded replicas that can sync from the remote database to a local SQLite file, and delegate writes to the remote primary database:
Embedded Replicas only works where you have access to the file system.
Manual Sync
The Sync
function allows you to sync manually the local database with the remote counterpart:
Periodic Sync
You can automatically sync at intervals using WithSyncInterval
and passing a time.Duration
as an argument. For example, to sync every minute, you can use the following code:
Read Your Writes
By default, the database connection ensures that writes are immediately visible to subsequent read operations initiated by the same connection.
You can disable this behaviour using WithReadYourWrites(false)
:
Encryption
To enable encryption on a SQLite file, pass the encryption key value as an argument to the constructor:
Encrypted databases appear as raw data and cannot be read as standard SQLite databases. You must use the libSQL client for any operations — learn more.
Was this page helpful?