libSQL Rust Reference
tokio
.
Feature | Description |
---|---|
remote | Enables the HTTP-only client, allowing communication with a remote sqld server using pure Rust. Does not require compiling C code for SQLite. Suitable for projects that only need to interact with a remote database. |
core | Enables the local database only, incorporating the C SQLite3 code into the build. This is the foundation for local database operations but does not include additional features like replication or encryption. |
replication | Combines core with additional code required for replication, enabling the embedded replica features. |
encryption | Enables encryption at rest support, adding the necessary code to compile encryption capabilities and expose functions for configuring it. This is optional and not enabled by default, catering to projects that require enhanced data security. |
core
and replication
features require a c compiler. The encryption
feature requires cmake
to be installed on your system.new_local
:
new_remote_replica
that can sync from the remote URL and delegate writes to the remote primary database:
sync
function allows you to sync manually the local database with the remote counterpart:
sqld
(libSQL Server), you can do this using new_local_replica
and sync_frames
. Reach out to us on Discord if you want to learn more.sync_interval
function allows you to set an interval for automatic synchronization of the database in the background:
read_your_writes
function configures the database connection to ensure that writes are immediately visible to subsequent read operations initiated by the same connection. This is enabled by default, and is particularly important in distributed systems to ensure consistency from the perspective of the writing process.
You can disable this behavior by passing false
to the function:
new_local
or new_remote_replica
), make sure you have the encryption
feature enabled, and pass the encryption_config
:
execute()
to invoke a SQL statement, as well as optional arguments:
prepare()
and then execute it with query()
:
de::from_row
function to deserialize a row into a struct:
transaction()
— with default transaction behavior (DEFFERED
)transaction_with_behavior()
— with custom transaction behavior