update Rust bindings to pass encryption options

This commit is contained in:
Avinash Sajjanshetty
2025-10-02 18:51:44 +05:30
parent 593fd5fb88
commit 4ee6bdac1b

View File

@@ -48,7 +48,7 @@ pub use params::IntoParams;
use std::fmt::Debug;
use std::num::NonZero;
use std::sync::{Arc, Mutex};
use turso_core::OpenFlags;
use turso_core::{EncryptionOpts, OpenFlags};
// Re-exports rows
pub use crate::rows::{Row, Rows};
@@ -84,6 +84,7 @@ pub struct Builder {
enable_mvcc: bool,
enable_encryption: bool,
vfs: Option<String>,
encryption_opts: Option<EncryptionOpts>,
}
impl Builder {
@@ -94,6 +95,7 @@ impl Builder {
enable_mvcc: false,
enable_encryption: false,
vfs: None,
encryption_opts: None,
}
}
@@ -107,6 +109,11 @@ impl Builder {
self
}
pub fn with_encryption(mut self, opts: EncryptionOpts) -> Self {
self.encryption_opts = Some(opts);
self
}
pub fn with_io(mut self, vfs: String) -> Self {
self.vfs = Some(vfs);
self
@@ -124,7 +131,7 @@ impl Builder {
self.path.as_str(),
OpenFlags::default(),
opts,
None,
self.encryption_opts.clone(),
)?;
Ok(Database { inner: db })
}