Skip to main content

Crate mentat_script

Crate mentat_script 

Source
Expand description

Backend-independent mino mentat.store/* scripting glue (plan § 1.19).

Both Mentat backends — the embedded SQLite [Store] and the pg_mentat engine — expose the same Datomic-a-like mentat.store/* language surface (14 prims). This crate holds everything that surface needs that does not depend on the storage engine:

A backend implements ScriptBackend (storage + its own result conversion: Binding→Value for Mentat, JSON→Value for pg_mentat) and calls install. The Datomic-model test suite (tests/model.rs) runs against a fake in-memory backend here, and against both real backends in their own crates — one suite, proven three ways.

Re-exports§

pub use prims::install;
pub use values::db_value;
pub use values::destructure_db;
pub use values::inst_value;
pub use values::kw_ns;
pub use values::str_val;
pub use values::tx_report_value;
pub use values::DbRef;
pub use values::TxReport;

Modules§

model_tests
The Datomic-model test suite for the mentat.store/* scripting surface, written once and run against every [ScriptBackend] (plan § 1.19).
prims
install: register all 14 mentat.store/* prims onto a mino interpreter, each driving through a shared ScriptBackend. Argument parsing, the db-value shape, and result wrapping live here; storage and result conversion live in the backend.
values
Backend-independent mino Value builders and the DbRef shape shared by both Mentat scripting backends (SQLite Store and pg_mentat’s engine).

Traits§

ScriptBackend
The storage seam between the shared mentat.store/* surface and a concrete engine. A backend owns storage and its own result conversion (each read method returns an already-built mino Value); the shared install owns argument parsing, the db-value shape, and result wrapping.