mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-25 07:58:58 +00:00
15 lines
489 B
TypeScript
15 lines
489 B
TypeScript
import type { TreeNode } from "@/types/database";
|
|
|
|
export function findDatabaseTreeNode(nodes: TreeNode[], connectionId: string, database: string): TreeNode | null {
|
|
for (const node of nodes) {
|
|
if (node.type === "database" && node.connectionId === connectionId && node.database === database) {
|
|
return node;
|
|
}
|
|
if (node.children) {
|
|
const found = findDatabaseTreeNode(node.children, connectionId, database);
|
|
if (found) return found;
|
|
}
|
|
}
|
|
return null;
|
|
}
|