frust-database 0.5.2

Synchronous local SQL database for Frust apps, backed by SQLite (default) or the optional turso engine.
Documentation
[package]
name = "frust-database"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
description = "Synchronous local SQL database for Frust apps, backed by SQLite (default) or the optional turso engine."
repository.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
readme = "README.md"

[dependencies]
# DatabaseError variants callers match on — thiserror per CODE_STANDARDS.
thiserror = { workspace = true }
# Leaf data-dir resolution only (`open(name)`'s `<data_dir>/databases/<name>.db`
# path) — the sole `frust-*` dependency this crate needs. Unlike every other
# plugin under `plugins/`, this crate carries NO `frust-plugin` dependency:
# it needs no JNI/platform handle, since both SQL engines (rusqlite/turso)
# reach on-disk SQLite storage directly rather than through an OS capability
# API — see this crate's `lib.rs` charter doc.
frust-paths = { path = "../../crates/frust-paths", version = "0.5.2" }
# One `debug!` line: the macOS legacy-base read-through in `resolve_db_path`
# names both candidate paths when it opens the legacy database instead of
# the new-location one, so a surprising open location is diagnosable.
log = { workspace = true }
# The sqlite engine backend (default, `engine-sqlite`) — optional so
# `cargo check -p frust-database --no-default-features` still resolves to a
# database-engine-free skeleton, the same way `engine-turso` below is optional.
rusqlite = { workspace = true, optional = true }
# The turso engine backend (non-default, `engine-turso`) — an async API this
# crate bridges onto its synchronous seam. Optional, and off by default: it
# roughly doubles this crate's binary contribution (~5.7 MB measured at the
# ship profile), so an app opts in rather than paying for an engine it isn't
# using.
turso = { workspace = true, optional = true }
# `rt` only — the whole tokio surface `src/turso.rs`'s bridge needs is one
# current-thread runtime to drive turso's futures on its own thread.
# Deliberately NOT `rt-multi-thread`/`time`/`net`: this crate never spawns a
# worker pool, and turso's local engine drives its own IO rather than tokio's
# reactor (`frust-reactive` owns the process's real multi-thread runtime — see
# docs/CORE_ARCHITECTURE.md).
tokio = { workspace = true, optional = true, features = ["rt"] }

[features]
default = ["engine-sqlite"]
engine-sqlite = ["dep:rusqlite"]
# The turso engine backend plus the tokio runtime its async-to-sync bridge
# runs on (`src/turso.rs`). Strictly additive: off by default, and a build
# with both engine features on compiles both backends and lets
# `OpenOptions::engine` pick between them per handle.
engine-turso = ["dep:turso", "dep:tokio"]
# Compiles the crate-private cross-engine conformance suite (`src/conformance.rs`)
# outside a `#[cfg(test)]` build too — off by default; `cargo test` already
# implies `cfg(test)`, so a normal `cargo test -p frust-database` run needs no
# extra flag. This widens the door for a future harness that exercises the
# suite without a full test build, matching this crate's `mod conformance`
# `cfg` (see `src/lib.rs`).
conformance = []