refactor(desktop): organize lib modules by domain

This commit is contained in:
t8y2 committed 2026-07-04 13:53:52 +08:00
1 parent 90f0594e93
commit 7e7c4944e9
700 files changed
+1292 -1264

No files matched your search

@@ -0,0 +1,28 @@
import type { QueryTab, ColumnInfo } from "@/types/database";
export type DataTabTableMeta = NonNullable<QueryTab["tableMeta"]>;
function fallbackColumnInfo(name: string): ColumnInfo {
return {
name,
data_type: "",
is_nullable: true,
column_default: null,
is_primary_key: false,
extra: null,
};
}
export function tableMetaForDataTab(tab: QueryTab | undefined): DataTabTableMeta | undefined {
if (!tab || tab.mode !== "data") return undefined;
if (tab.tableMeta) return tab.tableMeta;
const tableName = tab.title.trim();
if (!tableName) return undefined;
return {
schema: tab.schema,
tableName,
columns: (tab.result?.columns ?? []).map(fallbackColumnInfo),
primaryKeys: [],
};
}