feat(doris): show external catalogs in sidebar
This commit is contained in:
1 parent
47d9257ac2
commit
d9bb92d1e9
36 files changed
+1680
-174
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { DatabaseType, TreeNodeType } from "@/types/database";
|
||||
import type { ConnectionConfig, DatabaseType, TreeNodeType } from "@/types/database";
|
||||
import { supportsDatabaseFeature } from "@/lib/database/databaseDriverManifest";
|
||||
import { canEditTableStructure } from "@/lib/table/tableStructureCapabilities";
|
||||
import { DATABASE_OBJECT_TREE_TYPES, FETCH_FIRST_TYPES, PG_LIKE_STRUCTURE_TYPES, SCHEMA_AWARE_TYPES, SINGLE_DATABASE_TYPES, TREE_SCHEMA_TYPES } from "@/lib/database/databaseCapabilitySets";
|
||||
@@ -7,6 +7,35 @@ export function isSchemaAware(dbType?: DatabaseType): boolean {
|
||||
return !!dbType && SCHEMA_AWARE_TYPES.has(dbType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Doris-family engines that support multi-catalog federation (`SHOW CATALOGS`):
|
||||
* Doris (incl. SelectDB) and StarRocks. Manticore Search shares the MySQL code
|
||||
* path but has no catalog concept, so it is excluded.
|
||||
*/
|
||||
export function isDorisFamilyCatalogCapable(dbType?: DatabaseType, driverProfile?: string | null): boolean {
|
||||
if (dbType === "doris" || dbType === "starrocks") return true;
|
||||
return driverProfile === "doris" || driverProfile === "selectdb" || driverProfile === "starrocks";
|
||||
}
|
||||
|
||||
export function connectionIsDorisFamilyCatalogCapable(connection: Pick<ConnectionConfig, "db_type" | "driver_profile"> | undefined): boolean {
|
||||
if (!connection) return false;
|
||||
return isDorisFamilyCatalogCapable(connection.db_type, connection.driver_profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a Doris/StarRocks catalog is the engine's built-in (non-federated)
|
||||
* catalog. Doris names it `internal` (Type=`internal`); StarRocks names it
|
||||
* `default_catalog` (Type=`Internal`). The `catalogType` column is the
|
||||
* cross-engine signal, so it is matched case-insensitively, falling back to the
|
||||
* canonical Doris name `internal` when the type is absent (very old / proxied
|
||||
* deployments). Mirrors `CatalogInfo::is_internal` on the backend.
|
||||
*/
|
||||
export function isInternalDorisCatalog(catalogType?: string | null, catalogName?: string | null): boolean {
|
||||
const type = (catalogType ?? "").trim().toLowerCase();
|
||||
if (type) return type === "internal";
|
||||
return (catalogName ?? "").trim() === "internal";
|
||||
}
|
||||
|
||||
export function usesTreeSchemaMode(dbType?: DatabaseType): boolean {
|
||||
return !!dbType && TREE_SCHEMA_TYPES.has(dbType);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user