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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
import type { KvValue } from "@/lib/backend/api";
export type KvExportScopeKind = "key" | "prefix";
export interface KvExportScopeRequest {
path: string;
kind: KvExportScopeKind;
keyBytes?: KvValue | null;
}
export function kvDirectoryPrefix(path: string): string {
if (!path || path === "/") return path;
return `${path.replace(/\/+$/, "")}/`;
}
export function isKeyInKvExportScope(key: string, request: KvExportScopeRequest): boolean {
if (request.kind === "key") return key === request.path;
return key === request.path || key.startsWith(kvDirectoryPrefix(request.path));
}
export function kvExportFilenameStem(path: string): string {
const normalized = path
.split("/")
.filter(Boolean)
.join("-")
.replace(/[<>:"\\|?*\u0000-\u001f]/g, "-")
.replace(/\s+/g, "-")
.replace(/-+/g, "-")
.replace(/^-|-$/g, "");
return normalized.slice(0, 80) || "root";
}
export function kvValueByteIdentity(value: KvValue): string {
const bytes = value.encoding === "utf8" ? new TextEncoder().encode(value.data) : Uint8Array.from(atob(value.data.replace(/\s+/g, "")), (character) => character.charCodeAt(0));
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
}