index.js (536B)
1 // src/lib/db/index.js - database driver selection. 2 // 3 // Drivers expose all(), get(), run(), exec(), transaction() and close(). 4 // Queries use named {name} markers. 5 6 import { openSqlite } from './sqlite.js'; 7 8 export const DIALECTS = ['sqlite']; 9 10 export async function openDatabase({ dialect = 'sqlite', path }) { 11 switch (dialect) { 12 case 'sqlite': 13 return openSqlite({ database: { path } }); 14 default: 15 throw new Error(`unsupported database dialect: ${dialect}`); 16 } 17 } 18 19 export { runMigrations } from './migrate.js';