merge: add YashanDB driver support

This commit is contained in:
t8y2 2026-05-18 14:40:22 +08:00
commit 34c46d5d54
13 changed files with 39 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -163,6 +163,7 @@ const driverProfiles: Record<
gaussdb: { type: "gaussdb", port: 5432, user: "gaussdb", label: "GaussDB", icon: "gaussdb" },
kingbase: { type: "kingbase", port: 54321, user: "system", label: "KingBase", icon: "kingbase" },
highgo: { type: "highgo", port: 5866, user: "highgo", label: "瀚高 HighGo", icon: "highgo" },
yashandb: { type: "yashandb", port: 1688, user: "sys", label: "崖山 YashanDB", icon: "yashandb" },
vastbase: { type: "vastbase", port: 5432, user: "vastbase", label: "Vastbase", icon: "vastbase" },
doris: { type: "mysql", port: 9030, user: "root", label: "Doris", icon: "doris", urlParams: "" },
selectdb: {
@ -342,6 +343,7 @@ function defaultDatabaseForProfile() {
if (form.value.db_type === "gaussdb") return "postgres";
if (selectedType.value === "cockroachdb") return "defaultdb";
if (form.value.db_type === "highgo") return "highgo";
if (form.value.db_type === "yashandb") return "yasdb";
if (form.value.db_type === "postgres" || form.value.db_type === "kingbase" || form.value.db_type === "vastbase")
return "postgres";
if (form.value.db_type === "sqlserver") return "master";
@ -376,6 +378,7 @@ const iconTypeMap: Record<string, string> = {
gaussdb: "gaussdb",
kingbase: "kingbase",
highgo: "highgo",
yashandb: "yashandb",
vastbase: "vastbase",
doris: "doris",
selectdb: "selectdb",
@ -425,6 +428,7 @@ const dbOptions = [
{ value: "opengauss", label: "openGauss" },
{ value: "kingbase", label: "KingBase" },
{ value: "highgo", label: "瀚高 HighGo" },
{ value: "yashandb", label: "崖山 YashanDB" },
{ value: "vastbase", label: "Vastbase" },
{ value: "redshift", label: "Redshift" },
{ value: "cockroachdb", label: "CockroachDB" },
@ -1229,6 +1233,7 @@ function openExternalUrl(url: string) {
form.db_type === 'informix' ||
form.db_type === 'kingbase' ||
form.db_type === 'highgo' ||
form.db_type === 'yashandb' ||
form.db_type === 'vastbase' ||
form.db_type === 'goldendb'
"

View File

@ -29,6 +29,7 @@ const assetIcons: Record<string, string> = {
kingbase: "kingbase",
goldendb: "goldendb.png",
vastbase: "vastbase.png",
yashandb: "yashandb.png",
snowflake: "snowflake",
h2: "h2",
dm: "dm",

View File

@ -33,6 +33,7 @@ export function connectionUrlPlaceholder(dbType: DatabaseType): string {
case "postgres":
case "gaussdb":
case "yashandb":
case "redshift":
return "postgresql://user:password@host:port/database";

View File

@ -40,6 +40,7 @@ const SCHEME_PROFILES: Record<string, ConnectionProfile> = {
dm: { type: "dameng", profile: "dm", label: "DM (Dameng)", defaultPort: 5236 },
dameng: { type: "dameng", profile: "dm", label: "DM (Dameng)", defaultPort: 5236 },
gaussdb: { type: "gaussdb", profile: "gaussdb", label: "GaussDB", defaultPort: 5432 },
yashandb: { type: "yashandb", profile: "yashandb", label: "崖山 YashanDB", defaultPort: 1688 },
opengauss: { type: "gaussdb", profile: "opengauss", label: "openGauss", defaultPort: 5432 },
tdengine: { type: "tdengine", profile: "tdengine", label: "TDengine", defaultPort: 6041 },
"taos-ws": { type: "tdengine", profile: "tdengine", label: "TDengine", defaultPort: 6041 },

View File

@ -10,6 +10,7 @@ export const SCHEMA_AWARE_TYPES = new Set<DatabaseType>([
"kingbase",
"highgo",
"vastbase",
"yashandb",
"jdbc",
"h2",
"snowflake",
@ -33,6 +34,7 @@ export const DIAGRAM_SUPPORTED_TYPES = new Set<DatabaseType>([
"highgo",
"vastbase",
"goldendb",
"yashandb",
"access",
"h2",
"db2",
@ -53,6 +55,7 @@ export const DATABASE_SEARCH_SUPPORTED_TYPES = new Set<DatabaseType>([
"highgo",
"vastbase",
"goldendb",
"yashandb",
"access",
"h2",
"snowflake",
@ -85,6 +88,7 @@ export const TABLE_IMPORT_SUPPORTED_TYPES = new Set<DatabaseType>([
"highgo",
"vastbase",
"goldendb",
"yashandb",
"access",
]);
@ -132,6 +136,7 @@ export const TREE_SCHEMA_TYPES = new Set<DatabaseType>([
"kingbase",
"highgo",
"vastbase",
"yashandb",
"jdbc",
"trino",
"h2",
@ -145,6 +150,7 @@ export const AGENT_DRIVER_TYPES = new Set<DatabaseType>([
"kingbase",
"highgo",
"vastbase",
"yashandb",
"goldendb",
"access",
"oracle",

View File

@ -194,6 +194,7 @@ export const useConnectionStore = defineStore("connection", () => {
gaussdb: "GaussDB",
kingbase: "KingBase",
highgo: "瀚高 HighGo",
yashandb: "崖山 YashanDB",
vastbase: "Vastbase",
goldendb: "GoldenDB",
access: "Microsoft Access",

View File

@ -18,6 +18,7 @@ export type DatabaseType =
| "highgo"
| "vastbase"
| "goldendb"
| "yashandb"
| "access"
| "h2"
| "snowflake"

View File

@ -232,6 +232,7 @@ impl AppState {
| DatabaseType::Highgo
| DatabaseType::Vastbase
| DatabaseType::Goldendb
| DatabaseType::Yashandb
| DatabaseType::Oracle
| DatabaseType::H2
| DatabaseType::Snowflake

View File

@ -7,6 +7,7 @@ pub fn agent_key(db_type: &DatabaseType, driver_profile: Option<&str>) -> Option
DatabaseType::Highgo => Some("highgo"),
DatabaseType::Vastbase => Some("vastbase"),
DatabaseType::Goldendb => Some("goldendb"),
DatabaseType::Yashandb => Some("yashandb"),
DatabaseType::Oracle => match driver_profile {
Some("oracle-10g") => Some("oracle-10g"),
_ => Some("oracle"),
@ -45,6 +46,7 @@ pub fn is_single_connection_pool(db_type: &DatabaseType) -> bool {
| DatabaseType::Highgo
| DatabaseType::Vastbase
| DatabaseType::Goldendb
| DatabaseType::Yashandb
| DatabaseType::Access
| DatabaseType::Jdbc
)

View File

@ -128,6 +128,7 @@ pub enum DatabaseType {
Vastbase,
Goldendb,
Gaussdb,
Yashandb,
Access,
#[serde(rename = "h2")]
H2,
@ -175,6 +176,7 @@ impl ConnectionConfig {
DatabaseType::Gaussdb => Some("postgres"),
DatabaseType::Kingbase | DatabaseType::Vastbase => Some("postgres"),
DatabaseType::Highgo => Some("highgo"),
DatabaseType::Yashandb => Some("yasdb"),
_ => None,
}
}
@ -267,6 +269,7 @@ impl ConnectionConfig {
DatabaseType::Vastbase => format!("vastbase://{host}:{port}{db_part}"),
DatabaseType::Goldendb => format!("goldendb://{host}:{port}{db_part}"),
DatabaseType::Gaussdb => format!("gaussdb://{host}:{port}{db_part}"),
DatabaseType::Yashandb => format!("yashandb://{host}:{port}{db_part}"),
DatabaseType::H2 => format!("h2://{host}:{port}{db_part}"),
DatabaseType::Snowflake => format!("snowflake://{host}/{db_part}"),
DatabaseType::Trino => format!("trino://{host}:{port}{db_part}"),
@ -366,6 +369,9 @@ impl ConnectionConfig {
DatabaseType::Gaussdb => {
format!("gaussdb://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::Yashandb => {
format!("yashandb://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::H2 => {
format!("h2://{}:{}@{host}:{port}{db_part}", username, password)
}
@ -816,6 +822,14 @@ mod tests {
assert_eq!(config.connection_url(), "gaussdb://gaussdb:secret@10.1.2.3:2883/postgres");
}
#[test]
fn yashandb_url_defaults_to_yasdb_database() {
let mut config = mysql_config("sys", "secret", None);
config.db_type = DatabaseType::Yashandb;
assert_eq!(config.connection_url(), "yashandb://sys:secret@10.1.2.3:2883/yasdb");
}
#[test]
fn mongodb_form_url_without_params_does_not_force_topology_or_auth() {
let config = mongodb_config("root", "secret", Some("admin"));

View File

@ -9,6 +9,7 @@ fn maps_agent_database_types_to_driver_keys() {
assert_eq!(agent_key(&DatabaseType::Hive, None), Some("hive"));
assert_eq!(agent_key(&DatabaseType::Gaussdb, None), Some("gaussdb"));
assert_eq!(agent_key(&DatabaseType::Tdengine, None), Some("tdengine"));
assert_eq!(agent_key(&DatabaseType::Yashandb, None), Some("yashandb"));
assert_eq!(agent_key(&DatabaseType::Access, None), Some("access"));
assert_eq!(agent_key(&DatabaseType::Oracle, None), Some("oracle"));
assert_eq!(agent_key(&DatabaseType::Oracle, Some("oracle-10g")), Some("oracle-10g"));
@ -21,6 +22,7 @@ fn classifies_agent_database_types() {
assert!(is_agent_type(&DatabaseType::Trino));
assert!(is_agent_type(&DatabaseType::Hive));
assert!(is_agent_type(&DatabaseType::Tdengine));
assert!(is_agent_type(&DatabaseType::Yashandb));
assert!(is_agent_type(&DatabaseType::Access));
assert!(!is_agent_type(&DatabaseType::Mysql));
assert!(!is_agent_type(&DatabaseType::Jdbc));
@ -33,6 +35,7 @@ fn identifies_single_connection_pool_types() {
assert!(is_single_connection_pool(&DatabaseType::Oracle));
assert!(is_single_connection_pool(&DatabaseType::Dameng));
assert!(is_single_connection_pool(&DatabaseType::Access));
assert!(is_single_connection_pool(&DatabaseType::Yashandb));
assert!(is_single_connection_pool(&DatabaseType::Jdbc));
assert!(!is_single_connection_pool(&DatabaseType::Trino));
assert!(!is_single_connection_pool(&DatabaseType::Postgres));
@ -56,6 +59,7 @@ fn skips_tcp_probe_for_local_file_plugin_and_agent_types() {
assert!(skips_tcp_probe(&DatabaseType::Trino));
assert!(skips_tcp_probe(&DatabaseType::Oracle));
assert!(skips_tcp_probe(&DatabaseType::Tdengine));
assert!(skips_tcp_probe(&DatabaseType::Yashandb));
assert!(!skips_tcp_probe(&DatabaseType::Postgres));
assert!(!skips_tcp_probe(&DatabaseType::Mysql));
}

View File

@ -36,6 +36,7 @@ const AGENT_TYPES: &[(&str, &str)] = &[
("kylin", "Apache Kylin"),
("sundb", "SunDB"),
("gaussdb", "GaussDB"),
("yashandb", "崖山 YashanDB"),
("tdengine", "TDengine"),
("mongodb", "MongoDB (Legacy)"),
];
@ -112,6 +113,7 @@ mod tests {
let agents = build_agent_list(&manager, None);
assert!(agents.iter().any(|agent| agent.db_type == "tdengine" && agent.label == "TDengine"));
assert!(agents.iter().any(|agent| agent.db_type == "yashandb" && agent.label == "崖山 YashanDB"));
assert!(agents.iter().any(|agent| agent.db_type == "access" && agent.label == "Microsoft Access"));
let _ = std::fs::remove_dir_all(dir);
}