diff --git a/deno.json b/deno.json index b3a4d58..3dbda2d 100644 --- a/deno.json +++ b/deno.json @@ -10,14 +10,14 @@ "@/": "./src/" }, "lint": { - "include": ["src/"], + "include": ["src/", "lib/"], "rules": { "tags": ["recommended"], "exclude": ["no-explicit-any"] } }, "fmt": { - "include": ["src/"], + "include": ["src/", "lib/"], "useTabs": false, "lineWidth": 120, "indentWidth": 2, diff --git a/lib/kysely-deno-sqlite.ts b/lib/kysely-deno-sqlite.ts index 4a0467e..e7a4020 100644 --- a/lib/kysely-deno-sqlite.ts +++ b/lib/kysely-deno-sqlite.ts @@ -28,14 +28,18 @@ class DenoSqliteDatabase implements SqliteDatabase { } prepare(sql: string): SqliteStatement { + const query = this.#db.prepareQuery(sql); return { + // HACK: implement an actual driver to fix this. reader: true, all: (parameters: ReadonlyArray) => { - console.log(sql); - return this.#db.query(sql, parameters as any); + const result = query.allEntries(parameters as any); + query.finalize(); + return result; }, run: (parameters: ReadonlyArray) => { - this.#db.query(sql, parameters as any); + query.execute(parameters as any); + query.finalize(); return { changes: this.#db.changes, lastInsertRowid: this.#db.lastInsertRowId, diff --git a/src/db.ts b/src/db.ts index 08f8341..0e80655 100644 --- a/src/db.ts +++ b/src/db.ts @@ -1,4 +1,3 @@ -import { builder } from '@/db/builder.ts'; import { type Filter, Sqlite } from '@/deps.ts'; import { SignedEvent } from '@/event.ts'; @@ -111,6 +110,4 @@ const db = new DittoDB( new Sqlite('data/db.sqlite3'), ); -console.log(await builder.selectFrom('events').selectAll().limit(1).execute()) - export { db };