Expand description
SQLRite — a small SQLite clone written in Rust, as a library.
The REPL binary (src/main.rs) uses this library. The Tauri desktop
app under desktop/src-tauri/ uses it too. Future consumers — a
Connection API split, a WASM build, a C FFI shim — all grow out of
this same surface.
Scope right now. The library surfaces two layers:
1. High-level public API (Phase 5a). The shape most callers want — stable, documented, and the same surface that the C FFI shim (Phase 5b) and every language SDK (Python / Node / Go / WASM) binds against:
Connection— open a file, in-memory DB, or read-only viewStatement— prepared SQL with typed row iterationRows/Row/OwnedRow— streaming typed result rowsFromValue— pluggable row-to-Rust conversion (i64,f64,String,bool,Option<T>, plus rawValue)
use sqlrite::Connection;
let mut conn = Connection::open("foo.sqlrite")?;
conn.execute("INSERT INTO users (name) VALUES ('alice')")?;
let mut stmt = conn.prepare("SELECT id, name FROM users")?;
let mut rows = stmt.query()?;
while let Some(row) = rows.next()? {
let (id, name): (i64, String) = (row.get(0)?, row.get(1)?);
println!("{id}: {name}");
}2. Lower-level engine surface. Accessible via sqlrite::sql::…
for the REPL, the Tauri desktop app, and the engine’s own tests:
Database— the in-memory state owning all tablesprocess_command— parse + execute one SQL statement (returns the rendered status string the REPL prints)open_database/open_database_read_only/save_database— file I/O primitives (shared-lock read-only variant added in Phase 4e)AccessMode— the enum driving exclusive vs shared lock acquisitionResult/SQLRiteError— the error surface
Lower-level modules (sql::pager, sql::executor, etc.) remain
accessible through sqlrite::sql::… for tests and tooling, but
aren’t considered public API — their shapes will change as Phase 4
(WAL + locks) and Phase 5 (cursor / lazy-load) land.
Re-exports§
pub use connection::Connection;pub use connection::FromValue;pub use connection::OwnedRow;pub use connection::Row;pub use connection::Rows;pub use connection::Statement;pub use sql::db::table::Value;pub use error::Result;pub use error::SQLRiteError;pub use sql::db::database::Database;pub use sql::pager::AccessMode;pub use sql::pager::MASTER_TABLE_NAME;pub use sql::pager::open_database;pub use sql::pager::open_database_read_only;pub use sql::pager::open_database_with_mode;pub use sql::pager::save_database;pub use sql::process_command;pub use ::sqlparser;
Modules§
- connection
- Public
Connection/Statement/Rows/RowAPI (Phase 5a). - error
- sql