💾 Archived View for iich.space › src › db › sql.ts captured on 2022-03-01 at 15:59:54.
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
import { Statement } from 'better-sqlite3'; import db from '.'; export const sql = <T extends Array<unknown> = []>( literals: TemplateStringsArray, ...placeholders: Array<string> ): Statement<T> => { let string = ''; for (let n = 0; n < placeholders.length; n += 1) { string += literals[n]; string += placeholders[n]; } string += literals[literals.length - 1]; return db.prepare<T>(string); };