feat(spanner): add Google Cloud Spanner support

This commit is contained in:
Frost authored and GitHub committed 2026-08-20 16:33:09 +08:00
1 parent 2cc8d78e64
commit f494f90c30
74 files changed
+2920 -53

No files matched your search

+10 -2
View File
@@ -19,14 +19,22 @@ export function sortSidebarDatabases(databases: readonly DatabaseInfo[]): Databa
return [...databases].sort((left, right) => sidebarNameCollator.compare(left.name, right.name));
}
export function buildDatabaseTreeNodes(connectionId: string, databases: DatabaseInfo[], options: { includeDefaultWhenEmpty?: boolean } = {}): TreeNode[] {
export function buildDatabaseTreeNodes(
connectionId: string,
databases: DatabaseInfo[],
// `displayLabel` only rewrites the visible text. `id` and `database` keep the
// backend-reported name because that value round-trips to the agent — Cloud
// Spanner reports the full `projects/../instances/../databases/..` resource
// path and would break URL building if the shortened label were sent back.
options: { includeDefaultWhenEmpty?: boolean; displayLabel?: (name: string) => string } = {},
): TreeNode[] {
const nodes = sortSidebarDatabases(databases).flatMap((db) => {
const name = db.name;
if (!name.trim()) return [];
return [
{
id: `${connectionId}:${name}`,
label: name,
label: options.displayLabel?.(name) || name,
type: "database" as const,
connectionId,
database: name,