experiments in a post-browser web
at main 26 lines 1.2 kB view raw
1/** 2 * SQL Abstraction Layer Types 3 * 4 * Abstracts database operations to support multiple backends: 5 * - better-sqlite3 (Node.js, current) 6 * - Cloudflare Durable Objects SQLite (future) 7 * 8 * @typedef {Object} RunResult 9 * @property {number} changes - Number of rows changed by the statement 10 * @property {number} [lastInsertRowid] - Row ID of the last inserted row (if applicable) 11 * 12 * @typedef {Object} SqlAdapter 13 * @property {function(string): void} exec - Execute raw SQL (DDL, multi-statement) 14 * @property {function(string, unknown[]?): RunResult} run - Execute parameterized write 15 * @property {function(string, unknown[]?): (Object|null)} get - Query single row 16 * @property {function(string, unknown[]?): Object[]} all - Query all rows 17 * @property {function(function(): T): T} transaction - Execute within transaction 18 * @property {function(): void} close - Close connection 19 * 20 * @typedef {Object} SqlAdapterFactory 21 * @property {function(string, {readonly?: boolean}?): SqlAdapter} open - Open database connection 22 * @property {function(SqlAdapter): void} init - Platform-specific initialization 23 */ 24 25// Export empty object - types are defined via JSDoc above 26module.exports = {};