Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(mqtt): gate Tauri commands behind feature

t8y28d03d284d9ee
diff --git a/src-tauri/src/commands/connection.rs b/src-tauri/src/commands/connection.rs
index 3bb390945f..0fdc86df03 100644
--- a/src-tauri/src/commands/connection.rs
+++ b/src-tauri/src/commands/connection.rs
@@ -1098,12 +1098,17 @@ async fn test_connection_with_info_inner(
Err("Message queue admin support is not compiled in this build. Rebuild with the 'mq-admin' feature."
.to_string())
}
+ #[cfg(feature = "mq-admin")]
DatabaseType::Mqtt => {
let mqtt_config = dbx_core::mqtt::types::MqttConnectionConfig::from_connection(&config)?;
let client = dbx_core::mqtt::client::MqttClient::connect(mqtt_config).await?;
client.disconnect().await;
Ok("Connection successful".to_string())
}
+ #[cfg(not(feature = "mq-admin"))]
+ DatabaseType::Mqtt => {
+ Err("MQTT support is not compiled in this build. Rebuild with the 'mq-admin' feature.".to_string())
+ }
db_type if database_capabilities::is_agent_type(&db_type) => {
match test_agent_connection(state, &config, &host, port).await {
Ok(details) => {
@@ -1455,11 +1460,16 @@ pub async fn connect_db(
state.external_driver_pool("jdbc", &jdbc_config).await?
}
DatabaseType::Jdbc => state.external_driver_pool("jdbc", &db_config).await?,
+ #[cfg(feature = "mq-admin")]
DatabaseType::Mqtt => {
let mqtt_config = dbx_core::mqtt::types::MqttConnectionConfig::from_connection(&db_config)?;
let client = dbx_core::mqtt::client::MqttClient::connect(mqtt_config).await?;
PoolKind::Mqtt(client)
}
+ #[cfg(not(feature = "mq-admin"))]
+ DatabaseType::Mqtt => {
+ return Err("MQTT support is not compiled in this build. Rebuild with the 'mq-admin' feature.".to_string());
+ }
db_type => return Err(format!("Unsupported database type: {db_type:?}")),
};
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index 5050c745bd..0e4cf50b28 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -26,6 +26,7 @@ pub mod mcp_bridge;
pub mod mongo_cmd;
#[cfg(feature = "mq-admin")]
pub mod mq_cmd;
+#[cfg(feature = "mq-admin")]
pub mod mqtt_cmd;
pub mod nacos_cmd;
pub mod plugins;
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index c855a7d894..1519d31b75 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -1967,13 +1967,21 @@ pub fn run() {
commands::mq_cmd::mq_raw_request,
#[cfg(feature = "mq-admin")]
commands::mq_cmd::mq_send_message,
+ #[cfg(feature = "mq-admin")]
commands::mqtt_cmd::mqtt_get_broker_info,
+ #[cfg(feature = "mq-admin")]
commands::mqtt_cmd::mqtt_subscribe,
+ #[cfg(feature = "mq-admin")]
commands::mqtt_cmd::mqtt_unsubscribe,
+ #[cfg(feature = "mq-admin")]
commands::mqtt_cmd::mqtt_publish,
+ #[cfg(feature = "mq-admin")]
commands::mqtt_cmd::mqtt_list_topics,
+ #[cfg(feature = "mq-admin")]
commands::mqtt_cmd::mqtt_get_topic_tree,
+ #[cfg(feature = "mq-admin")]
commands::mqtt_cmd::mqtt_get_messages,
+ #[cfg(feature = "mq-admin")]
commands::mqtt_cmd::mqtt_clear_messages,
commands::history::save_history,
commands::history::load_history,