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
<script setup lang="ts">
import { computed, ref } from "vue";
import { Button } from "@/components/ui/button";
import { RefreshCw } from "@lucide/vue";
import type { GeneratorParams } from "@/lib/dataGrid/dataGenerate";
import { useI18n } from "vue-i18n";
const props = defineProps<{ params: GeneratorParams }>();
const { t } = useI18n();
function genUuid(hyphens: boolean): string {
const hex = "0123456789abcdef";
const parts = [8, 4, 4, 4, 12];
const uuid = parts.map((len) => {
let s = "";
for (let i = 0; i < len; i++) s += hex[Math.floor(Math.random() * 16)];
return s;
});
return hyphens ? uuid.join("-") : uuid.join("");
}
const previewVal = computed(() => {
void previewKey.value;
return genUuid(props.params.uuidHyphens !== false);
});
const regex = computed(() => (props.params.uuidHyphens !== false ? "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" : "^[0-9a-f]{32}$"));
const previewKey = ref(0);
function refresh() {
previewKey.value++;
}
</script>
<template>
<div class="space-y-3">
<div class="rounded-md border bg-muted/10 p-3">
<div class="text-xs text-muted-foreground mb-2">{{ t("dataGenerate.uuidFormat") }}</div>
<div class="flex items-center gap-2 text-xs">
<button type="button" class="px-2 py-1 rounded border text-xs" :class="params.uuidHyphens !== false ? 'bg-primary text-primary-foreground border-primary' : 'bg-background'" @click="params.uuidHyphens = true">{{ t("dataGenerate.uuidWithHyphens") }}</button>
<button type="button" class="px-2 py-1 rounded border text-xs" :class="params.uuidHyphens === false ? 'bg-primary text-primary-foreground border-primary' : 'bg-background'" @click="params.uuidHyphens = false">{{ t("dataGenerate.uuidNoHyphens") }}</button>
</div>
</div>
<div class="rounded-md border bg-muted/10 p-3">
<div class="text-xs text-muted-foreground mb-1">{{ t("dataGenerate.regex") }}</div>
<code class="block text-xs font-mono bg-background rounded px-2 py-1 break-all">{{ regex }}</code>
</div>
<div class="rounded-md border bg-muted/10 p-3">
<div class="flex items-center gap-2 text-xs">
<span class="text-muted-foreground shrink-0">{{ t("dataGenerate.preview") }}</span>
<span :key="previewKey" class="font-mono text-sm break-all">{{ previewVal }}</span>
<Button variant="ghost" size="icon" class="h-5 w-5 ml-auto shrink-0" @click="refresh">
<RefreshCw class="h-3 w-3" />
</Button>
</div>
</div>
</div>
</template>