(initSql?: string)
| 16 | * @param initSql |
| 17 | */ |
| 18 | export const initDB = async (initSql?: string) => { |
| 19 | if (!SQL) { |
| 20 | SQL = await initSqlJs({ |
| 21 | // Required to load the wasm binary asynchronously |
| 22 | locateFile: () => "./sql-wasm.wasm", |
| 23 | }); |
| 24 | } |
| 25 | // Create a database |
| 26 | const db = new SQL.Database(); |
| 27 | if (initSql) { |
| 28 | // Execute a single SQL string that contains multiple statements |
| 29 | db.run(initSql); // Run the query without returning anything |
| 30 | } |
| 31 | return db; |
| 32 | }; |
| 33 | |
| 34 | /** |
| 35 | * 执行 SQL |
nothing calls this directly
no outgoing calls
no test coverage detected