bookclerk_plugin_database_sqlite::sqlite
Local SQLite engine for the database plugin (rusqlite SeaORM proxy).
| Item | Kind | Summary |
|---|---|---|
SqliteProxy |
struct | SeaORM proxy over a shared rusqlite connection. |
open |
function | Opens a SQLite file and returns a SeaORM proxy (no schema application). |
drop_unit_files |
function | Deletes a SQLite binding unit and journal sidecars. Missing files are success. |
open_memory |
function | Opens an in-memory SQLite database, applies host schema, and returns a SeaORM proxy. |
open_memory_unmigrated |
function | Opens in-memory SQLite without applying schema (guest-shaped connect). |
open_store |
function | Opens SQLite at path, applies host schema, and wraps it as a LibraryStore. |
open_store_memory |
function | Opens an in-memory LibraryStore for tests. |
pub struct SqliteProxy {
/* private fields */
}
SeaORM proxy over a shared rusqlite connection.
pub fn new(conn: Connection) -> Result<Self>
Wraps an already-opened rusqlite connection for SeaORM proxy queries.
Call after the host applies schema (see open / open_memory).
Returns when this connection refuses the query-deadline progress
handler. rusqlite 0.38+ returns that error when the handle is not owned
by this Connection, which would leave statements without a deadline.
Implements: Debug, ProxyDatabaseTrait
pub async fn open(path: &Path) -> Result<DatabaseConnection, DbErr>
Opens a SQLite file and returns a SeaORM proxy (no schema application).
The host applies DDL after openSession + capability negotiation.
Returns DbErr when the parent directory cannot be created, the file
cannot be opened, the query-deadline handler cannot be installed, or the
SeaORM proxy cannot connect.
pub fn drop_unit_files(unit_ref: &str) -> Result<(), DbErr>
Deletes a SQLite binding unit and journal sidecars. Missing files are success.
Called from the sqlite adapter's Database.dropUnit implementation so the
host does not link this crate to unlink plugin-database files.
Returns when a sidecar exists but cannot be removed.
pub async fn open_memory() -> Result<DatabaseConnection>
Opens an in-memory SQLite database, applies host schema, and returns a SeaORM proxy.
Intended for unit tests and dry-run paths (no durable file). Version
selection lives in bookclerk_library::apply_host_schema.
Returns bookclerk_library::LibraryError when the SeaORM proxy or host schema fails.
pub async fn open_memory_unmigrated() -> Result<DatabaseConnection, DbErr>
Opens in-memory SQLite without applying schema (guest-shaped connect).
Returns DbErr when the in-memory database cannot be opened, the
query-deadline handler cannot be installed, or the SeaORM proxy fails.
pub async fn open_store(path: &Path) -> Result<LibraryStore>
Opens SQLite at path, applies host schema, and wraps it as a LibraryStore.
Prefer this entry point from CLI / tests that need the high-level library
API rather than a raw DatabaseConnection. Production guests use open.
path- Absolute path to the SQLite database file.
Propagates errors from open or host schema application.
pub async fn open_store_memory() -> Result<LibraryStore>
Opens an in-memory LibraryStore for tests.
Propagates errors from open_memory.
Generated from crates/bookclerk-plugins/platform/database-sqlite at main · View as Markdown