Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add autoload extension config api #214

Merged
merged 2 commits into from
Sep 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ impl Config {
self.config.unwrap_or(std::ptr::null_mut() as ffi::duckdb_config)
}

/// enable autoload extensions
pub fn enable_autoload_extension(mut self, enabled: bool) -> Result<Config> {
self.set("autoinstall_known_extensions", &(enabled as i32).to_string())?;
self.set("autoload_known_extensions", &(enabled as i32).to_string())?;
Ok(self)
}

/// Access mode of the database ([AUTOMATIC], READ_ONLY or READ_WRITE)
pub fn access_mode(mut self, mode: AccessMode) -> Result<Config> {
self.set("access_mode", &mode.to_string())?;
Expand Down Expand Up @@ -174,6 +181,7 @@ mod test {
.default_order(crate::DefaultOrder::Desc)?
.enable_external_access(true)?
.enable_object_cache(false)?
.enable_autoload_extension(true)?
.allow_unsigned_extensions()?
.max_memory("2GB")?
.threads(4)?;
Expand Down
Loading