mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-29 16:18:55 +00:00
feat: add 12 new agent-driven databases, migrate GaussDB to agent
Add H2, Snowflake, Trino, Hive, DB2, Informix, Neo4j, Cassandra, BigQuery, Apache Kylin, SunDB as new agent-driven database types. Migrate GaussDB from native rust-gaussdb to JDBC agent. Remove rust-gaussdb dependency. Total agent-driven databases: 17.
This commit is contained in:
@@ -18,6 +18,19 @@ pub async fn list_installed_agents(state: State<'_, Arc<AppState>>) -> Result<Ve
|
||||
("kingbase", "人大金仓 KingbaseES"),
|
||||
("vastbase", "Vastbase"),
|
||||
("goldendb", "GoldenDB"),
|
||||
("oracle", "Oracle"),
|
||||
("h2", "H2"),
|
||||
("snowflake", "Snowflake"),
|
||||
("trino", "Trino (Presto)"),
|
||||
("hive", "Apache Hive"),
|
||||
("db2", "IBM DB2"),
|
||||
("informix", "IBM Informix"),
|
||||
("neo4j", "Neo4j"),
|
||||
("cassandra", "Apache Cassandra"),
|
||||
("bigquery", "Google BigQuery"),
|
||||
("kylin", "Apache Kylin"),
|
||||
("sundb", "SunDB"),
|
||||
("gaussdb", "GaussDB"),
|
||||
];
|
||||
|
||||
Ok(agent_types
|
||||
|
||||
@@ -106,7 +106,19 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Goldendb
|
||||
| DatabaseType::Oracle => {
|
||||
| DatabaseType::Oracle
|
||||
| DatabaseType::H2
|
||||
| DatabaseType::Snowflake
|
||||
| DatabaseType::Trino
|
||||
| DatabaseType::Hive
|
||||
| DatabaseType::Db2
|
||||
| DatabaseType::Informix
|
||||
| DatabaseType::Neo4j
|
||||
| DatabaseType::Cassandra
|
||||
| DatabaseType::Bigquery
|
||||
| DatabaseType::Kylin
|
||||
| DatabaseType::Sundb
|
||||
| DatabaseType::Gaussdb => {
|
||||
state
|
||||
.agent_manager
|
||||
.call_daemon::<serde_json::Value>(
|
||||
@@ -123,15 +135,6 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
|
||||
.await?;
|
||||
Ok("Connection successful".to_string())
|
||||
}
|
||||
DatabaseType::Gaussdb => db::gaussdb_driver::connect(
|
||||
&host,
|
||||
port,
|
||||
config.database.as_deref().unwrap_or(""),
|
||||
&config.username,
|
||||
&config.password,
|
||||
)
|
||||
.await
|
||||
.map(|_| "Connection successful".to_string()),
|
||||
DatabaseType::Jdbc => {
|
||||
let mut jdbc_config = config.clone();
|
||||
if host != config.host || port != config.port {
|
||||
@@ -214,7 +217,19 @@ pub async fn connect_db(state: State<'_, Arc<AppState>>, config: ConnectionConfi
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Goldendb
|
||||
| DatabaseType::Oracle => {
|
||||
| DatabaseType::Oracle
|
||||
| DatabaseType::H2
|
||||
| DatabaseType::Snowflake
|
||||
| DatabaseType::Trino
|
||||
| DatabaseType::Hive
|
||||
| DatabaseType::Db2
|
||||
| DatabaseType::Informix
|
||||
| DatabaseType::Neo4j
|
||||
| DatabaseType::Cassandra
|
||||
| DatabaseType::Bigquery
|
||||
| DatabaseType::Kylin
|
||||
| DatabaseType::Sundb
|
||||
| DatabaseType::Gaussdb => {
|
||||
let mut client = state.agent_manager.spawn(&db_config.db_type).await?;
|
||||
client
|
||||
.call::<serde_json::Value>(
|
||||
@@ -230,17 +245,6 @@ pub async fn connect_db(state: State<'_, Arc<AppState>>, config: ConnectionConfi
|
||||
.await?;
|
||||
PoolKind::Agent(std::sync::Arc::new(tokio::sync::Mutex::new(client)))
|
||||
}
|
||||
DatabaseType::Gaussdb => {
|
||||
let client = db::gaussdb_driver::connect(
|
||||
&host,
|
||||
port,
|
||||
db_config.database.as_deref().unwrap_or(""),
|
||||
&db_config.username,
|
||||
&db_config.password,
|
||||
)
|
||||
.await?;
|
||||
PoolKind::Gaussdb(std::sync::Arc::new(tokio::sync::Mutex::new(client)))
|
||||
}
|
||||
DatabaseType::Jdbc => state.external_driver_pool("jdbc", &db_config).await?,
|
||||
};
|
||||
|
||||
@@ -268,7 +272,6 @@ pub async fn disconnect_db(state: State<'_, Arc<AppState>>, connection_id: Strin
|
||||
PoolKind::SqlServer(_) => {}
|
||||
PoolKind::Elasticsearch(_) => {}
|
||||
PoolKind::Agent(_) => {}
|
||||
PoolKind::Gaussdb(_) => {}
|
||||
PoolKind::ExternalTabular(_) => {}
|
||||
PoolKind::ExternalDriver { .. } => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user