( db: Awaited<ReturnType<typeof getDB>>, table: string, )
| 115 | const tableColumnCache = new Map<string, Set<string>>(); |
| 116 | |
| 117 | async 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 | |
| 130 | async function filterRecordToExistingColumns( |
| 131 | db: Awaited<ReturnType<typeof getDB>>, |
no test coverage detected