From e5fc08317a975d9c3861f815b1dbcae0c543ff8f Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Tue, 5 Aug 2025 11:27:37 +0200 Subject: [PATCH] bindings/rust: add with_mvcc option --- bindings/rust/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bindings/rust/src/lib.rs b/bindings/rust/src/lib.rs index ebaa0293c..e95bb199d 100644 --- a/bindings/rust/src/lib.rs +++ b/bindings/rust/src/lib.rs @@ -81,6 +81,7 @@ pub type Result = std::result::Result; /// A builder for `Database`. pub struct Builder { path: String, + enable_mvcc: bool, } impl Builder { @@ -88,9 +89,15 @@ impl Builder { pub fn new_local(path: &str) -> Self { Self { path: path.to_string(), + enable_mvcc: false, } } + pub fn with_mvcc(mut self, mvcc_enabled: bool) -> Self { + self.enable_mvcc = mvcc_enabled; + self + } + /// Build the database. #[allow(unused_variables, clippy::arc_with_non_send_sync)] pub async fn build(self) -> Result { @@ -100,7 +107,7 @@ impl Builder { let db = turso_core::Database::open_file( io, self.path.as_str(), - false, + self.enable_mvcc, indexes_enabled(), )?; Ok(Database { inner: db })