feat(build): gate DuckDB behind optional feature, support --no-default-features

This commit is contained in:
t8y2 committed 2026-06-11 13:58:44 +08:00
1 parent 65f6e866b1
commit a81286fed7
7 files changed
+47 -2

No files matched your search

+6
View File
@@ -318,6 +318,7 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
drop(con);
Ok("Connection successful".to_string())
}
#[cfg(feature = "duckdb-bundled")]
DatabaseType::DuckDb => {
if state.duckdb_existing_pool_is_usable_for_config(&config).await? {
Ok("Connection successful".to_string())
@@ -327,6 +328,8 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
Ok("Connection successful".to_string())
}
}
#[cfg(not(feature = "duckdb-bundled"))]
DatabaseType::DuckDb => Err("DuckDB support not compiled (enable duckdb-bundled feature)".to_string()),
DatabaseType::MongoDb => {
let native_err = match db::mongo_driver::connect(&url, connect_timeout, idle_timeout).await {
Ok(client) => {
@@ -522,6 +525,7 @@ pub async fn connect_db(state: State<'_, Arc<AppState>>, config: ConnectionConfi
};
con
}
#[cfg(feature = "duckdb-bundled")]
DatabaseType::DuckDb => {
let con = db::duckdb_driver::connect_path(&expand_tilde(&db_config.host))?;
{
@@ -532,6 +536,8 @@ pub async fn connect_db(state: State<'_, Arc<AppState>>, config: ConnectionConfi
}
PoolKind::DuckDb(con)
}
#[cfg(not(feature = "duckdb-bundled"))]
DatabaseType::DuckDb => return Err("DuckDB support not compiled (enable duckdb-bundled feature)".to_string()),
DatabaseType::MongoDb => {
let native_err = match db::mongo_driver::connect(&url, connect_timeout, idle_timeout).await {
Ok(client) => {
+1
View File
@@ -276,6 +276,7 @@ pub fn build_create_database_sql(options: dbx_core::db_admin_sql::CreateDatabase
Ok(dbx_core::db_admin_sql::build_create_database_sql(options))
}
#[cfg(feature = "duckdb-bundled")]
#[tauri::command]
pub fn build_duckdb_attach_database_sql(
options: dbx_core::db_admin_sql::DuckDbAttachDatabaseSqlOptions,