From b53a6dac8c04d63a3ec9ee60b0b2805da7400a37 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Mon, 25 May 2026 22:54:58 +0800 Subject: [PATCH] docs: add 7 new docs pages and update 4 existing ones Add new pages: Redis Browser, MongoDB Browser, Driver Management, Keyboard Shortcuts, Object Browser, Connection Import, SQL Snippets. Update: Data Grid (transpose view, column formatters, multi-row ops), Table Structure Editor (PK editing, column reorder, tab UI), AI Assistant (thinking mode, table mentions), Database Support (ClickHouse TLS, GaussDB native, DuckDB modes). --- docs/content/docs/ai-assistant.cn.mdx | 22 +++++- docs/content/docs/ai-assistant.mdx | 22 +++++- docs/content/docs/connection-import.cn.mdx | 78 ++++++++++++++++++ docs/content/docs/connection-import.mdx | 78 ++++++++++++++++++ docs/content/docs/data-grid.cn.mdx | 57 ++++++++++++- docs/content/docs/data-grid.mdx | 57 ++++++++++++- docs/content/docs/databases.cn.mdx | 21 +++++ docs/content/docs/databases.mdx | 21 +++++ docs/content/docs/driver-management.cn.mdx | 88 +++++++++++++++++++++ docs/content/docs/driver-management.mdx | 88 +++++++++++++++++++++ docs/content/docs/keyboard-shortcuts.cn.mdx | 68 ++++++++++++++++ docs/content/docs/keyboard-shortcuts.mdx | 68 ++++++++++++++++ docs/content/docs/meta.cn.json | 7 ++ docs/content/docs/meta.json | 8 ++ docs/content/docs/mongodb.cn.mdx | 68 ++++++++++++++++ docs/content/docs/mongodb.mdx | 68 ++++++++++++++++ docs/content/docs/object-browser.cn.mdx | 60 ++++++++++++++ docs/content/docs/object-browser.mdx | 60 ++++++++++++++ docs/content/docs/redis.cn.mdx | 77 ++++++++++++++++++ docs/content/docs/redis.mdx | 77 ++++++++++++++++++ docs/content/docs/sql-snippets.cn.mdx | 77 ++++++++++++++++++ docs/content/docs/sql-snippets.mdx | 77 ++++++++++++++++++ docs/content/docs/table-structure.cn.mdx | 21 +++-- docs/content/docs/table-structure.mdx | 21 +++-- 24 files changed, 1273 insertions(+), 16 deletions(-) create mode 100644 docs/content/docs/connection-import.cn.mdx create mode 100644 docs/content/docs/connection-import.mdx create mode 100644 docs/content/docs/driver-management.cn.mdx create mode 100644 docs/content/docs/driver-management.mdx create mode 100644 docs/content/docs/keyboard-shortcuts.cn.mdx create mode 100644 docs/content/docs/keyboard-shortcuts.mdx create mode 100644 docs/content/docs/mongodb.cn.mdx create mode 100644 docs/content/docs/mongodb.mdx create mode 100644 docs/content/docs/object-browser.cn.mdx create mode 100644 docs/content/docs/object-browser.mdx create mode 100644 docs/content/docs/redis.cn.mdx create mode 100644 docs/content/docs/redis.mdx create mode 100644 docs/content/docs/sql-snippets.cn.mdx create mode 100644 docs/content/docs/sql-snippets.mdx diff --git a/docs/content/docs/ai-assistant.cn.mdx b/docs/content/docs/ai-assistant.cn.mdx index bba905555..7e0e8eb87 100644 --- a/docs/content/docs/ai-assistant.cn.mdx +++ b/docs/content/docs/ai-assistant.cn.mdx @@ -45,11 +45,31 @@ AI 生成的 SQL 不会自动执行。请在执行前检查表名、字段名、 | Ask | 生成 SQL、解释、修复、优化、方言转换或样例数据 | 不暗示已经执行 | | Agent | 当用户明确要求查询数据时,优先生成一条可执行 SQL | DBX 会先评估生成 SQL,再决定是否尝试执行 | +## Thinking 模式 + +对于支持扩展推理的供应商和模型(如启用了 thinking 的 Claude),DBX 在 AI 设置中提供了 **Thinking** 开关。启用后: + +- 模型在生成 SQL 前会花费更多时间推理 +- 复杂查询、多表 JOIN 和优化建议受益最大 +- 响应时间会增加,但对于非简单任务的输出质量会提高 + +可按任务开关 Thinking。简单查询和解释可关闭;复杂 Schema 推理、优化或调试时可启用。 + +## 表提及 + +在提示中使用 `@table` 或 `@schema.table` 告诉 AI 哪些表最重要: + +- `@users` — 在上下文中包含 `users` 表结构 +- `@public.orders` — 包含特定 schema 限定的表 +- 多个提及:`@users @orders @products` 同时包含三张表 + +表提及是控制 Schema 上下文最可靠的方式。即使完整 Schema 太大无法全部包含,它也能正常工作。 + ## Schema 上下文 AI 提示可以包含当前数据库类型、连接名称、数据库、当前 SQL、最近错误、结果预览和 Schema 上下文。Schema 上下文包含表、字段、索引和外键。 -当 Schema 很大时,DBX 会截断上下文。可以在提示中使用 `@table` 或 `@schema.table` 明确提到表名,让 AI 优先围绕这些表推理。 +当 Schema 很大时,DBX 会截断上下文。使用表提及来告诉 AI 优先围绕哪些表进行推理。 ## SQL 安全策略 diff --git a/docs/content/docs/ai-assistant.mdx b/docs/content/docs/ai-assistant.mdx index 3bc02c0aa..0487713fd 100644 --- a/docs/content/docs/ai-assistant.mdx +++ b/docs/content/docs/ai-assistant.mdx @@ -45,11 +45,31 @@ When no API key is configured, AI features should prompt the user to complete se | Ask | Generates SQL, explanations, fixes, optimizations, dialect conversions, or sample data | Does not imply anything has run | | Agent | Prioritizes one executable SQL statement when the user clearly asks DBX to query data | DBX evaluates the generated SQL before attempting execution | +## Thinking Mode + +For providers and models that support extended reasoning (such as Claude with thinking enabled), DBX exposes a **Thinking** toggle in AI settings. When enabled: + +- The model spends more time reasoning before generating SQL +- Complex queries, multi-table joins, and optimization suggestions benefit most +- Response time increases, but output quality improves for non-trivial tasks + +Toggle Thinking on or off per task. Leave it off for simple queries and explanations; enable it for complex schema reasoning, optimization, or debugging. + +## Table Mentions + +Use `@table` or `@schema.table` mentions in your prompt to tell the AI which tables matter most: + +- `@users` — includes the `users` table schema in context +- `@public.orders` — includes a specific schema-qualified table +- Multiple mentions: `@users @orders @products` includes all three tables + +Table mentions are the most reliable way to control schema context. They work even when the full schema is too large to include entirely. + ## Schema Context AI prompts can include the current database type, connection name, database, current SQL, recent error, result preview, and schema context. Schema context contains tables, columns, indexes, and foreign keys. -When a schema is large, DBX truncates context. Use `@table` or `@schema.table` mentions in your prompt to prioritize the tables you want AI to reason about. +When a schema is large, DBX truncates context. Use table mentions to prioritize the tables you want AI to reason about. ## SQL Safety Policy diff --git a/docs/content/docs/connection-import.cn.mdx b/docs/content/docs/connection-import.cn.mdx new file mode 100644 index 000000000..346c004ed --- /dev/null +++ b/docs/content/docs/connection-import.cn.mdx @@ -0,0 +1,78 @@ +--- +title: 连接导入 +description: 从 Navicat 和 DBeaver 导入连接,切换工具时无需重新输入连接信息。 +--- + +DBX 可以从其他数据库工具导入连接,在切换工具时无需手动重新创建大量连接。 + +## 支持的格式 + +| 来源 | 格式 | 导入内容 | +|---|---|---| +| Navicat | `.ncx` 导出文件 | 主机、端口、用户名、数据库类型、连接名称 | +| DBeaver | 连接配置文件 | 主机、端口、用户名、数据库类型、连接名称 | + + +导入的连接保留原始连接名称和类型。其他工具以加密格式存储的密码无法解密——导入后需要重新输入密码。 + + +## 导入 Navicat 连接 + + + + ### 从 Navicat 导出 + 在 Navicat 中,选择要迁移的连接。使用**文件 → 导出连接**并保存 `.ncx` 文件。 + + + ### 打开导入对话框 + 在 DBX 中,前往**设置 → 导入连接**,或右键点击侧边栏分组标题选择**导入连接**。 + + + ### 选择 NCX 文件 + 选择从 Navicat 导出的 `.ncx` 文件。 + + + ### 检查并完成 + DBX 解析文件并列出所有找到的连接。检查列表,在需要处重新输入密码并保存。 + + + +## 导入 DBeaver 连接 + + + + ### 找到 DBeaver 配置 + DBeaver 将连接存储在其工作区目录中。具体路径取决于操作系统和 DBeaver 版本。常见位置包括 `~/.local/share/DBeaverData/workspace6/General/.dbeaver/`。 + + + ### 打开导入对话框 + 在 DBX 中,前往**设置 → 导入连接**。 + + + ### 选择 DBeaver 文件 + 选择 DBeaver 连接配置文件(`.dbeaver-data-sources.xml` 或类似文件)。 + + + ### 检查并完成 + DBX 从配置中提取连接信息。重新输入无法解密的密码。 + + + +## 导入后 + +导入的连接与手动创建的连接一同出现在侧边栏中。你应该: + +- **测试每个连接**以验证导入的设置是否正常工作 +- **设置密码**,用于原始密码无法导入的连接 +- **分配连接颜色**以区分生产、测试和开发环境 +- **配置 SSH 隧道**,用于需要隧道访问的连接 +- **设置可见数据库过滤**,如果服务器包含大量数据库 + +## 无法导入的内容 + +| 设置 | 原因 | +|---|---| +| 加密密码 | 每个工具使用各自的加密方式,密码需要重新输入 | +| SSH 隧道密钥 | 密钥文件路径可能因机器而异,需要重新选择密钥文件 | +| 自定义驱动配置 | 驱动路径和版本是工具特定的 | +| 代理设置 | 在连接的代理标签页中重新配置 | diff --git a/docs/content/docs/connection-import.mdx b/docs/content/docs/connection-import.mdx new file mode 100644 index 000000000..7188f5bd5 --- /dev/null +++ b/docs/content/docs/connection-import.mdx @@ -0,0 +1,78 @@ +--- +title: Connection Import +description: Import connections from Navicat and DBeaver so you can switch to DBX without re-entering connection details. +--- + +DBX can import connections from other database tools, saving you from manually re-creating dozens of connections when switching tools. + +## Supported Formats + +| Source | Format | What's Imported | +|---|---|---| +| Navicat | `.ncx` export files | Host, port, username, database type, connection name | +| DBeaver | Connection configuration files | Host, port, username, database type, connection name | + + +Imported connections preserve the original connection name and type. Passwords stored in encrypted format by other tools cannot be decrypted — you will need to re-enter passwords after import. + + +## Import Navicat Connections + + + + ### Export from Navicat + In Navicat, select the connections you want to migrate. Use **File → Export Connections** and save the `.ncx` file. + + + ### Open Import Dialog + In DBX, go to **Settings → Import Connections** or right-click the sidebar group header and choose **Import Connections**. + + + ### Select the NCX File + Choose the `.ncx` file you exported from Navicat. + + + ### Review and Complete + DBX parses the file and lists all found connections. Review the list, re-enter passwords where needed, and save. + + + +## Import DBeaver Connections + + + + ### Locate DBeaver Configuration + DBeaver stores connections in its workspace directory. The exact path depends on your OS and DBeaver version. Common locations include `~/.local/share/DBeaverData/workspace6/General/.dbeaver/`. + + + ### Open Import Dialog + In DBX, go to **Settings → Import Connections**. + + + ### Select DBeaver Files + Choose the DBeaver connection configuration files (`.dbeaver-data-sources.xml` or similar). + + + ### Review and Complete + DBX extracts connection details from the configuration. Re-enter any passwords that could not be decrypted. + + + +## After Import + +Imported connections appear in the sidebar alongside manually created ones. You should: + +- **Test each connection** to verify the imported settings work +- **Set passwords** for connections where the original password could not be imported +- **Assign connection colors** to distinguish production, staging, and development environments +- **Configure SSH tunnels** for connections that require them +- **Set visible database filters** if the server contains many databases + +## What Cannot Be Imported + +| Setting | Reason | +|---|---| +| Encrypted passwords | Each tool uses proprietary encryption; passwords must be re-entered | +| SSH tunnel keys | Key file paths may differ between machines; re-select the key file | +| Custom driver configurations | Driver paths and versions are tool-specific | +| Proxy settings | Re-configure in the connection's Proxy tab | diff --git a/docs/content/docs/data-grid.cn.mdx b/docs/content/docs/data-grid.cn.mdx index 03def3e75..bfabb80ce 100644 --- a/docs/content/docs/data-grid.cn.mdx +++ b/docs/content/docs/data-grid.cn.mdx @@ -76,6 +76,57 @@ SQL 预览会展示 `UPDATE`、`INSERT` 或 `DELETE` 语句。这个步骤可以 - 多行内容 - 需要显式设置为 `NULL` 的字段 +## 转置视图 + +切换转置视图可互换行和列。适用场景: + +- 表有很多列但行数较少 +- 需要并排比较列的元数据(类型、默认值、可空标志) +- 查看具有宽列的单个行 + +转置视图保留所有表格功能:排序、过滤、编辑和导出均可正常使用。 + +## 列格式化器 + +自定义列格式化器让你控制特定列值的显示方式: + +- **日期时间格式化**:为日期和时间列选择显示格式 +- **JSON 路径提取**:使用 JSONPath 表达式从 JSON/JSONB 列中提取特定字段 +- **值掩码**:隐藏或部分掩码敏感值 +- **自定义模板**:为列定义自己的显示模板 + +从列头菜单配置格式化器。格式化器仅影响显示——不会更改底层数据。 + +## 单元格详情编辑器 + +单元格详情面板为单个单元格值提供完整的编辑器: + +- **值编辑器**:在更大的文本区域中编辑单元格内容,JSON 和 SQL 具有语法高亮 +- **设置 NULL**:将单元格显式设置为 NULL +- **图片预览**:当单元格包含图片 URL 时,详情面板会显示渲染后的预览 +- **时间编辑器**:日期和时间单元格使用专用的日期/时间选择器 + +## 多行操作 + +选中多行执行批量操作: + +- **批量克隆**:一次性复制多行 +- **批量删除**:一次性标记多行为待删除 +- **批量复制**:以 TSV、CSV、JSON、Markdown 或 INSERT 语句格式复制多行 +- **复制为 INSERT**:生成包含多行值的单条 `INSERT` 语句 +- **复制为 UPDATE**:为选中的行生成 `UPDATE` 语句 +- **复制不含主键**:生成排除自增主键的 INSERT 语句 + +## 列头控件 + +列头提供快速操作入口: + +- **排序**:点击切换升序、降序或清除排序。右键点击可打开排序上下文菜单。 +- **列可见性**:从可搜索的清单中显示或隐藏列 +- **本地列过滤**:通过勾选特定值在当前结果集中过滤 +- **紧凑模式**:在设置中启用后,列头操作(排序、格式化、过滤)收起为单个下拉菜单,给列名留出更多空间 +- **紧凑过滤构建器**:在紧凑 UI 中使用多个条件构建复杂的客户端过滤 + ## 导出与复制 | 格式 | 用途 | @@ -83,10 +134,12 @@ SQL 预览会展示 `UPDATE`、`INSERT` 或 `DELETE` 语句。这个步骤可以 | CSV | 给 Excel、Numbers 或其他表格工具使用 | | JSON | 给脚本、接口调试或程序处理使用 | | Markdown | 粘贴到 Issue、PR、文档或聊天中 | -| INSERT | 将选中行复制为可执行的 `INSERT` 语句 | +| INSERT | 将选中行复制为可执行的 `INSERT` 语句(支持单行或批量) | +| UPDATE | 将选中行复制为可执行的 `UPDATE` 语句 | +| XLSX | 从表格上下文菜单直接导出为 Excel 格式 | 导出前建议先确认当前筛选和排序条件,避免导出范围和预期不一致。 ## 分页与大结果集 -DBX 会通过分页和虚拟滚动让大结果集保持响应。面对大表时,优先使用数据库侧的 `WHERE` 和 `ORDER BY`,不要只依赖客户端搜索;数据库可以利用索引,并返回更小的结果集。 +DBX 会通过分页和虚拟滚动让大结果集保持响应。面对大表时,优先使用数据库侧的 `WHERE` 和 `ORDER BY`,不要只依赖客户端搜索;数据库可以利用索引,并返回更小的结果集。分页大小可配置并跨会话持久化。 diff --git a/docs/content/docs/data-grid.mdx b/docs/content/docs/data-grid.mdx index f8d06b313..d36fb1c97 100644 --- a/docs/content/docs/data-grid.mdx +++ b/docs/content/docs/data-grid.mdx @@ -76,6 +76,57 @@ Click a cell to open the detail panel. It is useful for values that are awkward - Multi-line content - Fields that should be explicitly set to `NULL` +## Transpose View + +Toggle the transpose view to swap rows and columns. This is useful when: + +- A table has many columns but few rows +- You want to compare column metadata (types, defaults, nullable flags) side by side +- You are inspecting a single row with wide columns + +The transpose view preserves all grid features: sorting, filtering, editing, and export work the same way. + +## Column Formatters + +Custom column formatters let you control how specific column values are displayed: + +- **Datetime formatting**: Choose a display format for date and time columns +- **JSON path extraction**: Extract a specific field from JSON/JSONB columns using a JSONPath expression +- **Value masking**: Hide or partially mask sensitive values +- **Custom templates**: Define your own display template for a column + +Configure formatters from the column header menu. Formatters only affect display — they do not change the underlying data. + +## Cell Detail Editor + +The cell detail panel provides a full editor for individual cell values: + +- **Value editor**: Edit cell content in a larger text area with syntax highlighting for JSON and SQL +- **Set NULL**: Explicitly write NULL to a cell +- **Image preview**: When a cell contains an image URL, the detail panel shows a rendered preview +- **Temporal editor**: Date and time cells use a dedicated date/time picker + +## Multi-Row Operations + +Select multiple rows to perform batch operations: + +- **Batch clone**: Duplicate multiple rows at once +- **Batch delete**: Mark multiple rows for deletion in one action +- **Batch copy**: Copy multiple rows as TSV, CSV, JSON, Markdown, or INSERT statements +- **Copy as INSERT**: Generate a single `INSERT` statement with multiple value rows +- **Copy as UPDATE**: Generate `UPDATE` statements for selected rows +- **Copy without primary keys**: Generate INSERT statements that exclude auto-increment primary keys + +## Header Controls + +Column headers provide quick access to actions: + +- **Sort**: Click to toggle ascending, descending, or clear sort. Right-click for context menu with sort options. +- **Column visibility**: Show or hide columns from a filterable checklist +- **Local column filter**: Filter values within the current result set by checking specific values +- **Compact mode**: When enabled in Settings, header actions (sort, format, filter) collapse into a single dropdown menu, giving column names more space +- **Compact filter builder**: Build complex client-side filters with multiple conditions in a compact UI + ## Export and Copy | Format | Use Case | @@ -83,10 +134,12 @@ Click a cell to open the detail panel. It is useful for values that are awkward | CSV | Excel, Numbers, or spreadsheet tools | | JSON | Scripts, API debugging, or programmatic processing | | Markdown | Issues, PRs, documentation, or chat | -| INSERT | Copy selected rows as executable `INSERT` statements | +| INSERT | Copy selected rows as executable `INSERT` statements (single or batched) | +| UPDATE | Copy selected rows as executable `UPDATE` statements | +| XLSX | Export directly to Excel format from the table context menu | Before exporting, check the active filters and sort order so the exported data matches what you expect. ## Pagination And Large Results -DBX can page result sets and keep large grids responsive with virtual scrolling. For large tables, prefer database-side `WHERE` and `ORDER BY` clauses instead of relying only on client search, because the database can use indexes and return a smaller result set. +DBX can page result sets and keep large grids responsive with virtual scrolling. For large tables, prefer database-side `WHERE` and `ORDER BY` clauses instead of relying only on client search, because the database can use indexes and return a smaller result set. Page size is configurable and persists across sessions. diff --git a/docs/content/docs/databases.cn.mdx b/docs/content/docs/databases.cn.mdx index cc230535b..ec289be9e 100644 --- a/docs/content/docs/databases.cn.mdx +++ b/docs/content/docs/databases.cn.mdx @@ -83,6 +83,27 @@ DBX 只会在具备足够元数据和 SQL 生成能力的数据库上启用高 DBX 也可以解析常见连接 URL,例如 MySQL、PostgreSQL、Redis、MongoDB、ClickHouse、SQL Server、Oracle、Elasticsearch、DM、GaussDB、openGauss、TDengine 和 Access。 +### ClickHouse TLS + +ClickHouse 连接支持 TLS 加密。创建 ClickHouse 连接时,启用 TLS 开关即可通过 HTTPS 而非 HTTP 进行连接。建议对生产环境的 ClickHouse 实例或 ClickHouse Cloud 部署启用此选项。 + +### GaussDB 原生驱动 + +GaussDB 和 openGauss 现在使用原生 Rust 驱动(`rust-gaussdb`)而非 ODBC。之前使用 PostgreSQL 兼容路径的连接会自动迁移到 GaussDB 驱动。原生驱动提供更好的类型处理和针对 GaussDB 的元数据支持。 + +### DuckDB 文件与内存模式 + +DuckDB 连接支持两种模式: + +- **文件模式**:选择 `.db` 或 `.duckdb` 文件进行持久化存储 +- **内存模式**:使用内存数据库进行临时分析。连接关闭后数据会丢失。 + +可以直接从连接表单创建新的 DuckDB 数据库文件,只需输入尚不存在的文件路径即可。 + +### SQLite 内存模式 + +SQLite 连接可以使用 `:memory:` 作为文件路径,创建临时的内存数据库。适用于快速实验或临时数据转换。 + ## DM 与 ODBC DM 通过 ODBC 路径连接,需要在运行 DBX 的机器上安装 DM ODBC 驱动。 diff --git a/docs/content/docs/databases.mdx b/docs/content/docs/databases.mdx index 5df45de79..b396b0299 100644 --- a/docs/content/docs/databases.mdx +++ b/docs/content/docs/databases.mdx @@ -83,6 +83,27 @@ Most network databases support host, port, username, password, default database, DBX can also parse common connection URLs for engines such as MySQL, PostgreSQL, Redis, MongoDB, ClickHouse, SQL Server, Oracle, Elasticsearch, DM, GaussDB, openGauss, TDengine, and Access. +### ClickHouse TLS + +ClickHouse connections support TLS encryption. When creating a ClickHouse connection, enable the TLS toggle to connect over HTTPS instead of HTTP. This is recommended for production ClickHouse instances or any ClickHouse Cloud deployments. + +### GaussDB Native Driver + +GaussDB and openGauss now use a native Rust driver (`rust-gaussdb`) instead of ODBC. Connections that previously used the PostgreSQL compatibility path are auto-migrated to the GaussDB driver. The native driver provides better type handling and metadata support specific to GaussDB. + +### DuckDB File and Memory Modes + +DuckDB connections support two modes: + +- **File mode**: Select a `.db` or `.duckdb` file for persistent storage +- **Memory mode**: Use an in-memory database for temporary analysis. Data is lost when the connection is closed. + +Create a new DuckDB database file directly from the connection form by entering a path that does not yet exist. + +### In-Memory SQLite + +SQLite connections can use `:memory:` as the file path for ephemeral, in-memory databases. This is useful for quick experiments or temporary data transformations. + ## DM And ODBC DM uses an ODBC-based path and requires the DM ODBC driver installed on the machine running DBX. diff --git a/docs/content/docs/driver-management.cn.mdx b/docs/content/docs/driver-management.cn.mdx new file mode 100644 index 000000000..effab3d05 --- /dev/null +++ b/docs/content/docs/driver-management.cn.mdx @@ -0,0 +1,88 @@ +--- +title: 驱动管理 +description: 管理内置和 Agent 驱动的 JDBC 驱动,配置 JRE 版本,处理驱动更新。 +--- + +DBX 使用混合驱动架构:常用数据库使用内置原生驱动,需要供应商特定 JDBC 驱动的数据库使用 JDBC Agent 系统。 + +## 驱动架构 + +| 驱动类型 | 工作方式 | 适用场景 | +|---|---|---| +| 原生(内置) | Rust 驱动编译进 DBX | MySQL、PostgreSQL、SQLite、SQL Server、Oracle、Redis、MongoDB、DuckDB、ClickHouse 等 | +| JDBC Agent | DBX 管理的 Java 子进程 | 提供 JDBC 驱动的数据库:GaussDB、openGauss、DM、KingBase、HighGo、Vastbase、Trino、Hive、DB2、Informix、Neo4j、TDengine、YashanDB、GoldenDB、Kylin、SunDB 等 | + + +原生驱动安装后立即可用。Agent 驱动需要一次性下载 JDBC 驱动和 JRE 设置,首次创建连接时 DBX 会自动处理。 + + +## 驱动商店 + +驱动商店标签页显示所有可用的 Agent 驱动及其状态: + +- **已安装驱动**:版本号、大小和更新可用性 +- **可用驱动**:可一键安装的驱动 +- **更新角标**:注册中心有新版本时显示 + +从**设置 → 驱动**打开驱动商店,或点击创建需要 Agent 驱动的连接时出现的驱动提示。 + +## 安装驱动 + + + + ### 打开驱动商店 + 导航到**设置 → 驱动**或点击连接对话框中的驱动安装提示。 + + + ### 选择驱动 + 找到所需的数据库驱动。每个条目显示支持的数据库和驱动版本。 + + + ### 点击安装 + DBX 会下载 JDBC 驱动 JAR 及所需的依赖项。下载过程中显示进度。 + + + ### 创建连接 + 返回连接对话框。驱动此时即可使用。 + + + +## JRE 管理 + +JDBC Agent 驱动需要 Java 运行环境。DBX 内置 JRE 管理: + +- **系统 JRE**:DBX 可使用系统上已有的 Java 安装 +- **托管 JRE**:DBX 可下载并管理自己的 JRE,与系统 Java 隔离 +- **多 JRE 支持**:不同驱动可按需使用不同 JRE 版本 +- **重新安装**:如托管 JRE 损坏,可从驱动商店重新安装 + +## 驱动更新 + +DBX 会定期检查驱动更新: + +- 有新版本时,驱动商店标签页上会显示更新角标 +- 点击**升级全部驱动**一次性更新所有已安装的驱动 +- 单个驱动可从商店中对应条目升级 + +## 离线驱动导入 + +对于无法访问互联网的环境,DBX 支持离线驱动安装: + +1. 从另一台机器下载 JDBC 驱动 ZIP 包 +2. 将其传输到离线机器 +3. 在驱动商店中使用**从 ZIP 导入**安装驱动包 + +这适用于气隙网络、严格防火墙环境或企业中预先批准的驱动版本。 + +## 插件更新 + +对于由 [JDBC 插件](/cn/docs/plugins)支持的数据库,当有新插件版本可用时,DBX 会显示更新通知。插件更新遵循与内置 Agent 驱动相同的安装流程。 + +## 故障排除 + +| 问题 | 解决方案 | +|---|---| +| 驱动下载失败 | 检查网络连接和防火墙规则。尝试离线导入方法。 | +| Agent 无法启动 | 在驱动商店中验证 JRE 安装。如需要,重新安装托管 JRE。 | +| 驱动安装后连接测试失败 | 确认 JDBC URL 格式与驱动的预期格式匹配。检查 SSH/代理设置。 | +| 驱动版本错误 | 卸载当前驱动并从商店安装正确版本。 | diff --git a/docs/content/docs/driver-management.mdx b/docs/content/docs/driver-management.mdx new file mode 100644 index 000000000..4ed15fcc5 --- /dev/null +++ b/docs/content/docs/driver-management.mdx @@ -0,0 +1,88 @@ +--- +title: Driver Management +description: Manage built-in and agent-based JDBC drivers, configure JRE versions, and handle driver updates. +--- + +DBX uses a hybrid driver architecture: built-in native drivers for common databases and a JDBC agent system for databases that require vendor-specific JDBC drivers. + +## Driver Architecture + +| Driver Type | How It Works | Best For | +|---|---|---| +| Native (built-in) | Rust drivers compiled into DBX | MySQL, PostgreSQL, SQLite, SQL Server, Oracle, Redis, MongoDB, DuckDB, ClickHouse, and more | +| JDBC Agent | Java subprocess managed by DBX | Databases that provide JDBC drivers: GaussDB, openGauss, DM, KingBase, HighGo, Vastbase, Trino, Hive, DB2, Informix, Neo4j, TDengine, YashanDB, GoldenDB, Kylin, SunDB, and more | + + +Native drivers work immediately after installation. Agent drivers require a one-time JDBC driver download and JRE setup, which DBX handles automatically when you first create a connection. + + +## Driver Store + +The Driver Store tab shows all available agent drivers and their status: + +- **Installed drivers**: version number, size, and update availability +- **Available drivers**: drivers you can install with one click +- **Update badges**: when a newer version is available from the registry + +Open the Driver Store from **Settings → Drivers** or click the driver hint that appears when creating a connection that needs an agent driver. + +## Installing Drivers + + + + ### Open Driver Store + Navigate to **Settings → Drivers** or click the driver install hint in the connection dialog. + + + ### Choose a Driver + Find the database driver you need. Each entry shows the supported database and driver version. + + + ### Click Install + DBX downloads the JDBC driver JAR and any required dependencies. Progress is shown during download. + + + ### Create a Connection + Return to the connection dialog. The driver is now ready for use. + + + +## JRE Management + +JDBC agent drivers require a Java Runtime Environment. DBX includes JRE management: + +- **System JRE**: DBX can use an existing Java installation on your system +- **Managed JRE**: DBX can download and manage its own JRE, isolated from your system Java +- **Multi-JRE support**: Different drivers can target different JRE versions when needed +- **Reinstall**: Reinstall the managed JRE from the Driver Store if it becomes corrupted + +## Driver Updates + +DBX checks for driver updates periodically: + +- Update badges appear on the Driver Store tab when newer versions are available +- Click **Upgrade All Drivers** to update all installed drivers at once +- Individual drivers can be upgraded from their entry in the store + +## Offline Driver Import + +For environments without internet access, DBX supports offline driver installation: + +1. Download the JDBC driver ZIP bundle from another machine +2. Transfer it to the offline machine +3. In Driver Store, use **Import from ZIP** to install the driver bundle + +This is useful for air-gapped networks, strict firewall environments, or pre-approved driver versions in enterprise settings. + +## Plugin Updates + +For databases supported by the [JDBC Plugin](/en/docs/plugins), DBX shows update notices when a new plugin version is available. Plugin updates follow the same install flow as built-in agent drivers. + +## Troubleshooting + +| Problem | Solution | +|---|---| +| Driver download fails | Check network connectivity and firewall rules. Try the offline import method. | +| Agent won't start | Verify JRE installation in Driver Store. Reinstall the managed JRE if needed. | +| Connection test fails after driver install | Confirm the JDBC URL format matches the driver's expected format. Check SSH/proxy settings. | +| Wrong driver version | Uninstall the current driver and install the correct version from the store. | diff --git a/docs/content/docs/keyboard-shortcuts.cn.mdx b/docs/content/docs/keyboard-shortcuts.cn.mdx new file mode 100644 index 000000000..993e3c5fb --- /dev/null +++ b/docs/content/docs/keyboard-shortcuts.cn.mdx @@ -0,0 +1,68 @@ +--- +title: 快捷键 +description: 配置和使用键盘快捷键,高效导航 DBX、执行查询和编辑数据。 +--- + +DBX 为常用操作提供可配置的键盘快捷键。使用默认快捷键或自定义它们以匹配你的工作流程。 + +## 默认快捷键 + +### 查询编辑器 + +| 快捷键 | 操作 | +|---|---| +| `Ctrl+Enter` / `Cmd+Enter` | 执行当前查询 | +| `Ctrl+Shift+Enter` / `Cmd+Shift+Enter` | 执行所有查询 | +| `Ctrl+/` / `Cmd+/` | 切换行注释 | +| `Ctrl+F` / `Cmd+F` | 在编辑器中搜索 | +| `Ctrl+S` / `Cmd+S` | 保存当前标签页 | +| `Tab` | 缩进选中行 | +| `Shift+Tab` | 取消缩进选中行 | + +### 数据表格 + +| 快捷键 | 操作 | +|---|---| +| `F5` | 刷新当前数据 | +| `Ctrl+C` / `Cmd+C` | 复制选中单元格 | +| `Ctrl+Shift+C` / `Cmd+Shift+C` | 将选中行复制为 INSERT | +| `Delete` | 删除选中行(标记为待删除) | + +### 导航 + +| 快捷键 | 操作 | +|---|---| +| `Ctrl+N` / `Cmd+N` | 新建查询标签页 | +| `Ctrl+Shift+F` / `Cmd+Shift+F` | 聚焦侧边栏搜索 | +| `Ctrl+W` / `Cmd+W` | 关闭当前标签页 | +| `鼠标中键`(点击标签页) | 关闭标签页 | + +## 配置快捷键 + +打开**设置 → 快捷键**来自定义按键绑定: + +1. 在列表中找到要更改的操作 +2. 点击当前快捷键进入录制模式 +3. 按下新的按键组合 +4. 新快捷键自动保存 + + +快捷键使用 Electron 风格的修饰键表示法:`Ctrl`(Windows/Linux 的 Control)、`Cmd`(macOS 的 Command)、`Shift` 和 `Alt`(macOS 的 Option)。 + + +## 复制快捷键 + +两个可配置的复制快捷键控制行级别的复制行为: + +- **复制当前行**:将当前行复制为制表符分隔的值 +- **删除当前行**:将当前行标记为待删除 + +在**设置 → 快捷键**中设置它们以匹配你的偏好工作流程。 + +## 冲突解决 + +如果自定义快捷键与现有快捷键冲突: + +- DBX 会在保存前发出警告 +- 你可以选择保留冲突或选择其他组合 +- 系统快捷键(如 macOS 的 `Cmd+Q`)无法被覆盖 diff --git a/docs/content/docs/keyboard-shortcuts.mdx b/docs/content/docs/keyboard-shortcuts.mdx new file mode 100644 index 000000000..22e85dcd3 --- /dev/null +++ b/docs/content/docs/keyboard-shortcuts.mdx @@ -0,0 +1,68 @@ +--- +title: Keyboard Shortcuts +description: Configure and use keyboard shortcuts to navigate DBX, execute queries, and edit data efficiently. +--- + +DBX provides configurable keyboard shortcuts for common actions. Use the default shortcuts or customize them to match your workflow. + +## Default Shortcuts + +### Query Editor + +| Shortcut | Action | +|---|---| +| `Ctrl+Enter` / `Cmd+Enter` | Execute current query | +| `Ctrl+Shift+Enter` / `Cmd+Shift+Enter` | Execute all queries | +| `Ctrl+/` / `Cmd+/` | Toggle line comment | +| `Ctrl+F` / `Cmd+F` | Search in editor | +| `Ctrl+S` / `Cmd+S` | Save current tab | +| `Tab` | Indent selected lines | +| `Shift+Tab` | Outdent selected lines | + +### Data Grid + +| Shortcut | Action | +|---|---| +| `F5` | Refresh current data | +| `Ctrl+C` / `Cmd+C` | Copy selected cells | +| `Ctrl+Shift+C` / `Cmd+Shift+C` | Copy selected rows as INSERT | +| `Delete` | Delete selected rows (mark for deletion) | + +### Navigation + +| Shortcut | Action | +|---|---| +| `Ctrl+N` / `Cmd+N` | New query tab | +| `Ctrl+Shift+F` / `Cmd+Shift+F` | Focus sidebar search | +| `Ctrl+W` / `Cmd+W` | Close current tab | +| `Middle Click` (on tab) | Close tab | + +## Configuring Shortcuts + +Open **Settings → Shortcuts** to customize key bindings: + +1. Find the action you want to change in the list +2. Click the current shortcut to enter recording mode +3. Press the new key combination +4. The new shortcut is saved automatically + + +Shortcuts use the Electron-style modifier key notation: `Ctrl` (Control on Windows/Linux), `Cmd` (Command on macOS), `Shift`, and `Alt` (Option on macOS). + + +## Copy Shortcuts + +Two configurable copy shortcuts control row-level copy behavior: + +- **Copy Current Row**: Copies the current row as tab-separated values +- **Delete Current Row**: Marks the current row for deletion + +Set these in **Settings → Shortcuts** to match your preferred workflow. + +## Conflict Resolution + +If a custom shortcut conflicts with an existing one: + +- DBX warns you before saving +- You can choose to keep the conflict or choose a different combination +- System shortcuts (like `Cmd+Q` on macOS) cannot be overridden diff --git a/docs/content/docs/meta.cn.json b/docs/content/docs/meta.cn.json index 66b9ffc20..5e08d8d93 100644 --- a/docs/content/docs/meta.cn.json +++ b/docs/content/docs/meta.cn.json @@ -10,6 +10,9 @@ "query-editor", "data-grid", "schema-browser", + "redis", + "mongodb", + "object-browser", "---高级功能---", "schema-diff", "data-transfer", @@ -18,12 +21,16 @@ "table-import", "sql-file", "database-export", + "sql-snippets", "---AI 与自动化---", "ai-assistant", "cli", "mcp", "---设置---", "plugins", + "driver-management", + "keyboard-shortcuts", + "connection-import", "config-export", "ssh-tunnel" ] diff --git a/docs/content/docs/meta.json b/docs/content/docs/meta.json index bd8c0311f..d32065996 100644 --- a/docs/content/docs/meta.json +++ b/docs/content/docs/meta.json @@ -3,12 +3,16 @@ "pages": [ "---Introduction---", "what-is-dbx", + "changelog", "getting-started", "databases", "---Core Features---", "query-editor", "data-grid", "schema-browser", + "redis", + "mongodb", + "object-browser", "---Advanced Features---", "schema-diff", "data-transfer", @@ -17,12 +21,16 @@ "table-import", "sql-file", "database-export", + "sql-snippets", "---AI & Automation---", "ai-assistant", "cli", "mcp", "---Settings---", "plugins", + "driver-management", + "keyboard-shortcuts", + "connection-import", "config-export", "ssh-tunnel" ] diff --git a/docs/content/docs/mongodb.cn.mdx b/docs/content/docs/mongodb.cn.mdx new file mode 100644 index 000000000..6f0296e59 --- /dev/null +++ b/docs/content/docs/mongodb.cn.mdx @@ -0,0 +1,68 @@ +--- +title: MongoDB 浏览器 +description: 浏览 MongoDB 数据库和集合、查看文档,并使用内置 JSON 编辑器编辑数据。 +--- + +DBX 支持浏览和编辑 MongoDB 数据库,提供专为 MongoDB 灵活 schema 模型设计的文档导向界面。 + +## 集合浏览器 + +MongoDB 数据库和集合与关系型数据库一同显示在侧边栏中。浏览器支持: + +- 列出服务器上的所有数据库 +- 列出每个数据库中的集合 +- 集合文档的分页浏览 +- 文档查询的过滤和排序支持 + + +MongoDB 连接同时支持标准连接字符串和旧版连接格式。对于副本集,请使用标准的 `mongodb://` 连接 URL 并指定副本集名称。 + + +## 表格视图 + +集合以表格视图展示,将文档结构扁平化: + +- 顶层字段显示为列 +- 嵌套字段以点号表示(如 `address.city`) +- 各文档之间缺失的字段会被妥善处理 +- 列宽自动适应内容 + +## 文档查看器 + +点击任意文档可在详情面板中打开。JSON 查看器提供: + +- 语法高亮的 JSON 显示 +- 可折叠的嵌套对象和数组 +- 复制单个字段或整个文档 + +## 内联编辑 + +直接从表格视图编辑文档: + +- 双击单元格编辑其值 +- 更改会在本地暂存,保存前可预览 +- 应用前检查生成的更新命令 + +## JSON 编辑器 + +对于涉及嵌套字段的复杂编辑,可使用 JSON 编辑器: + +- 以 JSON 格式编辑整个文档 +- 保存前进行语法验证 +- 适用于添加新的嵌套字段或重构文档结构 + +## MongoDB 版本 + +DBX 通过内置驱动支持 MongoDB 4.2 及以上版本。对于 4.2 之前版本的 MongoDB 实例,DBX 可以回退到 JDBC Agent 驱动。有关配置 Agent 驱动的详细信息,请参阅[驱动管理](/cn/docs/driver-management)。 + +## 功能覆盖 + +| 功能 | 支持情况 | +|---|---| +| 列出数据库和集合 | 所有版本 | +| 分页文档浏览 | 所有版本 | +| 扁平化字段表格视图 | 所有版本 | +| 过滤和排序 | MongoDB 4.2+ | +| 内联编辑 | 所有版本 | +| JSON 文档编辑器 | 所有版本 | +| SSH 隧道 | 标准连接 | diff --git a/docs/content/docs/mongodb.mdx b/docs/content/docs/mongodb.mdx new file mode 100644 index 000000000..a3fd8f0b2 --- /dev/null +++ b/docs/content/docs/mongodb.mdx @@ -0,0 +1,68 @@ +--- +title: MongoDB Browser +description: Browse MongoDB databases and collections, view documents, and edit data with the built-in JSON editor. +--- + +DBX supports browsing and editing MongoDB databases with a document-oriented interface designed for MongoDB's flexible schema model. + +## Collections Browser + +MongoDB databases and collections appear in the sidebar alongside relational databases. The browser supports: + +- Listing all databases on the server +- Listing collections within each database +- Paginated document browsing within collections +- Filter and sort support for document queries + + +MongoDB connections support both standard connection strings and legacy connection formats. For replica sets, use the standard `mongodb://` connection URL with the replica set name. + + +## Table View + +Collections are displayed in a table view that flattens the document structure: + +- Top-level fields appear as columns +- Nested fields are shown in dot notation (e.g., `address.city`) +- Missing fields across documents are handled gracefully +- Column widths auto-fit to content + +## Document Viewer + +Click any document to open it in the detail panel. The JSON viewer provides: + +- Syntax-highlighted JSON display +- Collapsible nested objects and arrays +- Copy individual fields or the entire document + +## Inline Editing + +Edit documents directly from the table view: + +- Double-click a cell to edit its value +- Changes are staged locally before saving +- Review the generated update command before applying + +## JSON Editor + +For complex edits that span nested fields, use the JSON editor: + +- Edit the full document as JSON +- Syntax validation before saving +- Useful for adding new nested fields or restructuring documents + +## MongoDB Versions + +DBX supports MongoDB 4.2 and later through the built-in driver. For pre-4.2 MongoDB instances, DBX can fall back to the JDBC agent driver. See [Driver Management](/en/docs/driver-management) for details on configuring agent drivers. + +## Feature Coverage + +| Feature | Support | +|---|---| +| List databases and collections | All versions | +| Document browsing with pagination | All versions | +| Table view with flattened fields | All versions | +| Filter and sort | MongoDB 4.2+ | +| Inline editing | All versions | +| JSON document editor | All versions | +| SSH tunnel | Standard connections | diff --git a/docs/content/docs/object-browser.cn.mdx b/docs/content/docs/object-browser.cn.mdx new file mode 100644 index 000000000..a0824ab51 --- /dev/null +++ b/docs/content/docs/object-browser.cn.mdx @@ -0,0 +1,60 @@ +--- +title: 对象浏览器 +description: 浏览视图、存储过程、函数以及表与结构之外的数据库对象。 +--- + +对象浏览器将侧边栏的功能扩展到表和集合之外,集中展示那些通常需要单独查询才能查看的数据库对象。 + +## 对象浏览器展示的内容 + +| 对象类型 | 展示信息 | +|---|---| +| 视图 | 视图定义(DDL)、列列表、Schema | +| 存储过程 | 源代码、参数、语言 | +| 函数 | 返回类型、参数、源代码 | +| 触发器 | 时机、事件、关联表、源代码 | +| 例程 | 存储过程和函数的合并视图 | + + +对象浏览器的可用性取决于数据库引擎及其元数据支持。并非所有数据库都能通过标准 SQL 暴露源代码或例程元数据。 + + +## 打开对象浏览器 + +从侧边栏打开对象浏览器: + +- **双击**数据库或 Schema 节点打开其对象浏览器 +- 右键点击并从上下文菜单中选择**对象浏览器** +- 对任意对象使用**查看 DDL** 操作查看其源定义 + +## 查看 DDL + +**查看 DDL** 操作显示视图、存储过程或函数的完整 `CREATE` 语句: + +- 在只读 SQL 查看器中以语法高亮显示 +- 复制 DDL 用于迁移脚本或文档 +- 跨环境比较定义差异 + +## 编辑对象源代码 + +对于支持 `CREATE OR REPLACE` 语义的数据库,可以直接编辑对象源代码: + +- 存储过程和函数可编辑并保存 +- DBX 会生成适当的 `CREATE OR REPLACE` 或 `ALTER` 语句 +- 在应用更改前检查生成的 SQL + + +在数据库中直接编辑对象可能会影响正在运行的应用程序。在保存更改前请验证对象的使用情况,尤其是在生产数据库上。 + + +## 对象时间戳 + +当数据库提供时,对象浏览器会显示对象元数据时间戳: + +- 创建时间 +- 最后修改时间 +- 有助于追踪最近更改或发现过时对象 + +## 功能边界 + +对象源代码编辑仅支持允许程序化替换源代码的数据库。只读数据库、某些旧版本和部分云数据库服务可能不提供可编辑的对象源代码。在这些情况下,可使用对象浏览器进行查看,并复制 DDL 进行手动执行。 diff --git a/docs/content/docs/object-browser.mdx b/docs/content/docs/object-browser.mdx new file mode 100644 index 000000000..49e86cedf --- /dev/null +++ b/docs/content/docs/object-browser.mdx @@ -0,0 +1,60 @@ +--- +title: Object Browser +description: Browse views, procedures, functions, and other database objects beyond tables and schemas. +--- + +The Object Browser extends the sidebar beyond tables and collections. It surfaces database objects that are often hidden or require separate queries to inspect. + +## What the Object Browser Shows + +| Object Type | Information Shown | +|---|---| +| Views | View definition (DDL), column list, schema | +| Procedures | Source code, parameters, language | +| Functions | Return type, parameters, source code | +| Triggers | Timing, event, table, source | +| Routines | Combined view of procedures and functions | + + +Object Browser availability depends on the database engine and its metadata support. Not all databases expose source code or routine metadata through standard SQL. + + +## Opening the Object Browser + +Open the Object Browser from the sidebar: + +- **Double-click** a database or schema node to open its Object Browser +- Right-click and choose **Object Browser** from the context menu +- Use the **View DDL** action on any object to see its source definition + +## View DDL + +The **View DDL** action shows the complete `CREATE` statement for a view, procedure, or function: + +- Displayed in a read-only SQL viewer with syntax highlighting +- Copy the DDL to use in migration scripts or documentation +- Compare definitions between environments + +## Editing Object Source + +For databases that support `CREATE OR REPLACE` semantics, you can edit object source directly: + +- Procedures and functions can be edited and saved +- DBX generates the appropriate `CREATE OR REPLACE` or `ALTER` statement +- Review the generated SQL before applying changes + + +Editing database objects in place may affect running applications. Verify the object's usage before saving changes, especially on production databases. + + +## Object Timestamps + +When the database provides it, the Object Browser shows object metadata timestamps: + +- Creation time +- Last modification time +- Useful for tracking recent changes or finding stale objects + +## Feature Boundaries + +Object source editing is supported for databases that allow programmatic source replacement. Read-only databases, certain legacy versions, and some cloud database services may not expose editable object source. In those cases, use the Object Browser for inspection and copy the DDL for manual execution. diff --git a/docs/content/docs/redis.cn.mdx b/docs/content/docs/redis.cn.mdx new file mode 100644 index 000000000..2929da17e --- /dev/null +++ b/docs/content/docs/redis.cn.mdx @@ -0,0 +1,77 @@ +--- +title: Redis 浏览器 +description: 浏览 Redis 键、查看和编辑值、按模式搜索、以及跨所有 Redis 数据类型执行命令。 +--- + +DBX 提供完整的 Redis 键浏览器,支持所有核心 Redis 数据类型。它将浏览、编辑、搜索和命令执行整合到一个视图中,无需在 Redis CLI 和 GUI 之间切换。 + +## 键浏览器 + +Redis 键浏览器以表格形式展示键,便于扫描和过滤: + +- 键列表支持分页,避免在大型键空间上阻塞 +- 点击任意键可在详情面板中查看其值 +- 使用搜索栏按模式过滤键(如 `user:*`、`cache:*`) +- 内联显示键类型、TTL 和大小 + + +对于包含数百万键的 Redis 实例,建议在搜索栏中使用具体的键模式,而不是加载整个键空间。可在设置中调整扫描页大小,以控制每批获取的键数量。 + + +## 值查看器与编辑器 + +每种 Redis 数据类型都有专用的查看器和编辑器: + +| 类型 | 查看器 | 编辑方式 | +|---|---|---| +| String | 纯文本或 JSON 查看器 | 内联文本编辑 | +| Hash | 可调整列宽的字段/值表格 | 编辑单个字段 | +| List | 带索引的有序列表 | 添加、删除、重排元素 | +| Set | 带基数的成员列表 | 添加和删除成员 | +| Sorted Set | 带分数的成员列表 | 编辑成员和分数 | +| Stream | 带 ID 的条目列表 | 查看流条目 | + +## JSON 值查看器 + +对于包含有效 JSON 的 String 键,DBX 会自动渲染结构化 JSON 查看器,支持节点折叠、语法高亮和复制功能。 + +## 值搜索 + +按内容搜索 Redis 值,而不仅仅是键: + +- 扫描 String 值中的匹配文本 +- 按值查找 Hash 字段 +- 对于大型键空间,结果会逐步流式返回 + + +值搜索会扫描匹配当前模式的所有键。在大型数据库上这可能会消耗大量资源。在开始值搜索之前,请先缩小键模式范围。 + + +## 批量操作 + +一次性对多个键执行批量操作: + +- 一次删除多个键 +- 查看键统计信息,包括内存使用和访问模式 + +## 命令执行器 + +直接从 UI 执行任意 Redis 命令: + +- 以 Redis CLI 语法输入命令 +- 结果以结构化表格显示 +- 适用于 `INFO`、`CONFIG GET`、`CLIENT LIST` 等管理命令 + +## 清空数据库 + +**Flush DB** 按钮会删除当前 Redis 数据库中的所有键。此操作不可撤销。清空前请确认活动连接和数据库编号。 + +## 键统计 + +在设置中启用键统计跟踪,以监控: + +- 每个键的内存使用量 +- 访问频率 +- 空闲时间 + +这些数据有助于识别可能需要关注的大键或不常用键。 diff --git a/docs/content/docs/redis.mdx b/docs/content/docs/redis.mdx new file mode 100644 index 000000000..5d14b758d --- /dev/null +++ b/docs/content/docs/redis.mdx @@ -0,0 +1,77 @@ +--- +title: Redis Browser +description: Browse Redis keys, view and edit values, search by pattern, and run commands across all Redis data types. +--- + +DBX provides a full Redis key browser with support for all core Redis data types. It replaces the need to switch between a Redis CLI and a GUI by combining browsing, editing, searching, and command execution in one view. + +## Key Browser + +The Redis key browser displays keys in a table format for easier scanning and filtering: + +- Keys are paginated to avoid blocking on large keyspaces +- Click any key to open its value in the detail panel +- Use the search bar to filter keys by pattern (e.g., `user:*`, `cache:*`) +- Key type, TTL, and size are shown inline + + +For Redis instances with millions of keys, use specific key patterns in the search bar instead of loading the entire keyspace. Set the scan page size in Settings to control how many keys are fetched per batch. + + +## Value Viewer and Editor + +Each Redis data type has a dedicated viewer and editor: + +| Type | Viewer | Editing | +|---|---|---| +| String | Plain text or JSON viewer | Inline text edit | +| Hash | Field/value table with resizable columns | Edit individual fields | +| List | Ordered list with index | Add, remove, reorder elements | +| Set | Member list with cardinality | Add and remove members | +| Sorted Set | Member list with scores | Edit members and scores | +| Stream | Entry list with IDs | View stream entries | + +## JSON Value Viewer + +For String keys that contain valid JSON, DBX automatically renders a structured JSON viewer with collapsible nodes, syntax highlighting, and copy support. + +## Value Search + +Search Redis values by content, not just keys: + +- Scan String values for matching text +- Find Hash fields by value +- Results are streamed progressively for large keyspaces + + +Value search scans all keys that match the current pattern. On large databases this can be resource-intensive. Narrow the key pattern before starting a value search. + + +## Bulk Operations + +Perform batch actions on multiple keys at once: + +- Delete multiple keys in one operation +- View key statistics including memory usage and access patterns + +## Command Runner + +Execute arbitrary Redis commands directly from the UI: + +- Type commands in Redis CLI syntax +- Results are displayed in a structured table +- Useful for `INFO`, `CONFIG GET`, `CLIENT LIST`, and other admin commands + +## Flush Database + +The **Flush DB** button removes all keys from the current Redis database. This action cannot be undone. Confirm the active connection and database number before flushing. + +## Key Statistics + +Enable key statistics tracking in Settings to monitor: + +- Memory usage per key +- Access frequency +- Idle time + +This data helps identify large or infrequently used keys that may need attention. diff --git a/docs/content/docs/sql-snippets.cn.mdx b/docs/content/docs/sql-snippets.cn.mdx new file mode 100644 index 000000000..3dbae73d6 --- /dev/null +++ b/docs/content/docs/sql-snippets.cn.mdx @@ -0,0 +1,77 @@ +--- +title: SQL 代码片段 +description: 创建带有自定义触发键的可复用 SQL 模板,加速查询编写。 +--- + +SQL 代码片段允许你定义可复用的 SQL 模板,输入触发键时自动展开。这对于经常编写的查询模式、标准子句或团队特定的 SQL 约定非常有用。 + +## 代码片段工作原理 + +1. 使用**触发键**和**模板**定义一个代码片段 +2. 在 SQL 编辑器中输入触发键 +3. DBX 将触发键自动完成为完整模板 +4. 模板中的占位符让你可以按 Tab 键在可编辑位置之间跳转 + +## 创建代码片段 + + + + ### 打开代码片段设置 + 前往**设置 → SQL 代码片段**。 + + + ### 添加新片段 + 点击**添加片段**并填写: + - **触发键**:在编辑器中输入的简短关键字(如 `selall`、`joinex`) + - **模板**:替换触发键的 SQL 文本 + + + ### 使用代码片段 + 在 SQL 编辑器中输入触发键,然后按 `Tab` 或从自动补全列表中选择。模板会在光标处展开。 + + + +## 示例片段 + +以下是一些实用的片段模板: + +**带常用子句的 SELECT:** +```sql +SELECT ${1:columns} +FROM ${2:table} +WHERE ${3:condition} +ORDER BY ${4:column} +``` + +**LEFT JOIN 模式:** +```sql +LEFT JOIN ${1:table} ON ${2:left_alias}.${3:column} = ${4:right_alias}.${5:column} +``` + +**带 GROUP BY 的 COUNT:** +```sql +SELECT ${1:column}, COUNT(*) AS cnt +FROM ${2:table} +GROUP BY ${1:column} +HAVING COUNT(*) > ${3:threshold} +ORDER BY cnt DESC +``` + +**CREATE TABLE 模板:** +```sql +CREATE TABLE ${1:table_name} ( + ${2:id} INTEGER PRIMARY KEY, + ${3:column} ${4:type} +); +``` + +## 占位符 + +在模板中使用 `${1}`、`${2}` 等标记可编辑位置。展开后,按 `Tab` 在占位符之间跳转。相同编号的占位符会同时编辑。 + +## 使用建议 + +- 触发键保持简短但易记(3-6 个字符效果较好) +- 使用一致的前缀来区分个人片段(如 `my_selall`) +- 执行前检查展开的片段,尤其是在生产数据库上 +- 与团队分享实用的片段,以保持查询模式一致 diff --git a/docs/content/docs/sql-snippets.mdx b/docs/content/docs/sql-snippets.mdx new file mode 100644 index 000000000..d52d5402f --- /dev/null +++ b/docs/content/docs/sql-snippets.mdx @@ -0,0 +1,77 @@ +--- +title: SQL Snippets +description: Create customizable SQL snippet templates with custom trigger keys for faster query writing. +--- + +SQL Snippets let you define reusable SQL templates that expand automatically when you type a trigger key. This is useful for frequently written query patterns, standard clauses, or team-specific SQL conventions. + +## How Snippets Work + +1. You define a snippet with a **trigger key** and a **template** +2. In the SQL editor, type the trigger key +3. DBX auto-completes the trigger to the full template +4. Placeholders in the template let you tab through editable positions + +## Creating A Snippet + + + + ### Open Snippet Settings + Go to **Settings → SQL Snippets**. + + + ### Add a New Snippet + Click **Add Snippet** and fill in: + - **Trigger**: a short key you type in the editor (e.g., `selall`, `joinex`) + - **Template**: the SQL text that replaces the trigger + + + ### Use the Snippet + In the SQL editor, type the trigger key and press `Tab` or select it from the autocomplete list. The template expands in place. + + + +## Example Snippets + +Here are some useful snippet templates to get started: + +**SELECT with common clauses:** +```sql +SELECT ${1:columns} +FROM ${2:table} +WHERE ${3:condition} +ORDER BY ${4:column} +``` + +**LEFT JOIN pattern:** +```sql +LEFT JOIN ${1:table} ON ${2:left_alias}.${3:column} = ${4:right_alias}.${5:column} +``` + +**COUNT with GROUP BY:** +```sql +SELECT ${1:column}, COUNT(*) AS cnt +FROM ${2:table} +GROUP BY ${1:column} +HAVING COUNT(*) > ${3:threshold} +ORDER BY cnt DESC +``` + +**CREATE TABLE template:** +```sql +CREATE TABLE ${1:table_name} ( + ${2:id} INTEGER PRIMARY KEY, + ${3:column} ${4:type} +); +``` + +## Placeholders + +Use `${1}`, `${2}`, etc. in templates to mark editable positions. After expansion, press `Tab` to jump between placeholders. Placeholders with the same number are edited simultaneously. + +## Tips + +- Keep triggers short but memorable (3-6 characters works well) +- Use a consistent prefix for personal snippets (e.g., `my_selall`) +- Review expanded snippets before execution, especially on production databases +- Share useful snippets with your team for consistent query patterns diff --git a/docs/content/docs/table-structure.cn.mdx b/docs/content/docs/table-structure.cn.mdx index 7c33b4a91..f9241ff03 100644 --- a/docs/content/docs/table-structure.cn.mdx +++ b/docs/content/docs/table-structure.cn.mdx @@ -3,19 +3,30 @@ title: 表结构编辑器 description: 可视化编辑表字段和索引,并在保存前预览 DDL。 --- -表结构编辑器用于修改单张表的字段、索引和部分约束。它适合小范围结构调整,也适合在不手写 DDL 的情况下生成可审查的变更 SQL。 +表结构编辑器用于修改单张表的字段、索引和约束。它适合小范围结构调整,也适合在不手写 DDL 的情况下生成可审查的变更 SQL。 -表结构编辑器目前面向 MySQL、PostgreSQL、SQLite 和 SQL Server 开启。其他数据库仍可能在结构浏览器中展示 DDL,但当 DBX 无法可靠生成安全变更时,不会显示可视化编辑器。 +表结构编辑器目前面向 MySQL、PostgreSQL、SQLite、SQL Server 和 ClickHouse 开启。其他数据库仍可能在结构浏览器中展示 DDL,但当 DBX 无法可靠生成安全变更时,不会显示可视化编辑器。 ## 可以编辑什么 | 对象 | 支持操作 | |---|---| -| 字段 | 新增、删除;MySQL/PostgreSQL 支持修改已有字段,SQLite 支持重命名字段 | -| 索引 | 新增索引、删除已有非主键索引 | -| 注释 | MySQL/PostgreSQL 支持字段注释写入;PostgreSQL 支持索引注释 | +| 字段 | 新增、删除、重命名和修改字段;修改类型、长度、默认值、可空性和注释 | +| 主键 | 添加、修改或移除主键字段 | +| 索引 | 新增、删除和重建索引;配置索引类型、包含列、WHERE 过滤和注释 | +| 注释 | MySQL/PostgreSQL 支持字段和索引注释写入 | +| 列顺序 | 可视化调整列顺序;DBX 会生成对应的 ALTER 语句 | + +## 编辑器界面 + +表结构编辑器以持久化标签页形式打开,而非模态对话框: + +- **类型 + 长度分列**:数据类型和长度/精度分离为独立列,配有可搜索的下拉选择器 +- **可调整列宽**:拖拽列边框调整编辑器布局 +- **语法高亮**:SQL 预览使用 Shiki 语法高亮 +- **DDL 能力矩阵**:编辑器了解每种数据库支持的 DDL 操作,仅启用相关控件 不同数据库的 DDL 能力不完全一致,DBX 会按当前连接类型生成对应语法。 diff --git a/docs/content/docs/table-structure.mdx b/docs/content/docs/table-structure.mdx index 8846d1953..a93bc800d 100644 --- a/docs/content/docs/table-structure.mdx +++ b/docs/content/docs/table-structure.mdx @@ -3,19 +3,30 @@ title: Table Structure Editor description: Edit table columns and indexes visually, then preview DDL before applying changes. --- -The table structure editor modifies columns, indexes, and some constraints for a single table. Use it for focused structure changes or to generate reviewable DDL without writing it by hand. +The table structure editor modifies columns, indexes, and constraints for a single table. Use it for focused structure changes or to generate reviewable DDL without writing it by hand. -The structure editor is enabled for MySQL, PostgreSQL, SQLite, and SQL Server. Other databases may still expose DDL through the schema browser, but DBX does not show the visual editor when it cannot generate safe changes. +The structure editor is enabled for MySQL, PostgreSQL, SQLite, SQL Server, and ClickHouse. Other databases may still expose DDL through the schema browser, but DBX does not show the visual editor when it cannot generate safe changes. ## What You Can Edit | Object | Supported Actions | |---|---| -| Columns | Add and delete columns; MySQL/PostgreSQL can modify existing columns, and SQLite can rename columns | -| Indexes | Add indexes and delete existing non-primary indexes | -| Comments | MySQL/PostgreSQL can write column comments; PostgreSQL can write index comments | +| Columns | Add, delete, rename, and modify columns; change type, length, default, nullable, and comments | +| Primary Key | Add, modify, or remove primary key columns | +| Indexes | Add, delete, and rebuild indexes; configure index type, included columns, WHERE filter, and comments | +| Comments | MySQL/PostgreSQL can write column and index comments | +| Column Order | Reorder columns visually; DBX generates the appropriate ALTER statements | + +## Editor Interface + +The table structure editor opens as a persistent tab, not a modal dialog: + +- **Type + Length columns**: Data type and length/precision are split into separate columns with searchable select dropdowns +- **Resizable columns**: Drag column borders to adjust the editor layout +- **Syntax highlighting**: SQL preview uses Shiki syntax highlighting +- **DDL capability matrix**: The editor knows which DDL operations each database supports and only enables relevant controls Database engines differ in DDL capabilities. DBX generates SQL for the active connection type.