kysely adapter pretty much working!
This commit is contained in:
parent
d799075657
commit
465a3db501
|
@ -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,
|
||||
|
|
|
@ -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<unknown>) => {
|
||||
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<unknown>) => {
|
||||
this.#db.query(sql, parameters as any);
|
||||
query.execute(parameters as any);
|
||||
query.finalize();
|
||||
return {
|
||||
changes: this.#db.changes,
|
||||
lastInsertRowid: this.#db.lastInsertRowId,
|
||||
|
|
|
@ -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 };
|
||||
|
|
Loading…
Reference in New Issue