diff --git a/core/lib.rs b/core/lib.rs index f7d0421bb..d47c88d85 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -106,6 +106,7 @@ pub struct DatabaseOpts { pub enable_indexes: bool, pub enable_views: bool, pub enable_strict: bool, + enable_load_extension: bool, } impl Default for DatabaseOpts { @@ -115,6 +116,7 @@ impl Default for DatabaseOpts { enable_indexes: true, enable_views: false, enable_strict: false, + enable_load_extension: false, } } } @@ -124,6 +126,12 @@ impl DatabaseOpts { Self::default() } + #[cfg(feature = "cli_only")] + pub fn turso_cli(mut self) -> Self { + self.enable_load_extension = true; + self + } + pub fn with_mvcc(mut self, enable: bool) -> Self { self.enable_mvcc = enable; self @@ -755,6 +763,10 @@ impl Database { Ok((io, db)) } + pub(crate) fn can_load_extensions(&self) -> bool { + self.opts.enable_load_extension + } + #[inline] pub(crate) fn with_schema_mut(&self, f: impl FnOnce(&mut Schema) -> Result) -> Result { let mut schema_ref = self.schema.lock().map_err(|_| LimboError::SchemaLocked)?;