Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

1.1 KB
Raw Blame
export interface SidebarSearchExpansionState {
  readonly filteredNodeIds: Set<string>;
  readonly autoExpandedNodeIds: Set<string>;
  markFiltered(nodeId: string, autoExpanded: boolean): void;
  markUnfiltered(nodeId: string): boolean;
  shouldRestore(nodeId: string): boolean;
  hasTrackedNodes(): boolean;
  clear(): void;
}

export function createSidebarSearchExpansionState(): SidebarSearchExpansionState {
  const filteredNodeIds = new Set<string>();
  const autoExpandedNodeIds = new Set<string>();

  return {
    filteredNodeIds,
    autoExpandedNodeIds,
    markFiltered(nodeId, autoExpanded) {
      filteredNodeIds.add(nodeId);
      if (autoExpanded) autoExpandedNodeIds.add(nodeId);
    },
    markUnfiltered(nodeId) {
      return filteredNodeIds.delete(nodeId);
    },
    shouldRestore(nodeId) {
      return filteredNodeIds.has(nodeId) || autoExpandedNodeIds.has(nodeId);
    },
    hasTrackedNodes() {
      return filteredNodeIds.size > 0 || autoExpandedNodeIds.size > 0;
    },
    clear() {
      filteredNodeIds.clear();
      autoExpandedNodeIds.clear();
    },
  };
}