MCPcopy
hub / github.com/codedogQBY/ReadAny / getTableColumns

Function getTableColumns

packages/core/src/sync/simple-sync.ts:117–128  ·  view source on GitHub ↗
(
  db: Awaited<ReturnType<typeof getDB>>,
  table: string,
)

Source from the content-addressed store, hash-verified

115const tableColumnCache = new Map<string, Set<string>>();
116
117async function getTableColumns(
118 db: Awaited<ReturnType<typeof getDB>>,
119 table: string,
120): Promise<Set<string>> {
121 const cached = tableColumnCache.get(table);
122 if (cached) return cached;
123
124 const rows = await db.select<{ name: string }>(`PRAGMA table_info(${table})`);
125 const columns = new Set(rows.map((row) => row.name));
126 tableColumnCache.set(table, columns);
127 return columns;
128}
129
130async function filterRecordToExistingColumns(
131 db: Awaited<ReturnType<typeof getDB>>,

Callers 2

loadExistingRecordStatesFunction · 0.85

Calls 2

mapMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected