Skip to content

Commit

Permalink
chore: add dummy qb
Browse files Browse the repository at this point in the history
  • Loading branch information
nichenqin committed Dec 4, 2024
1 parent 224922e commit 4b48570
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Binary file modified bun.lockb
Binary file not shown.
22 changes: 20 additions & 2 deletions packages/persistence/src/qb.client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { drizzle } from "drizzle-orm/sql-js"
import { DummyDriver, Kysely, SqliteAdapter, SqliteIntrospector, SqliteQueryCompiler, type Dialect } from "kysely"
import { SqlJsDialect } from "kysely-wasm"
import InitSqlJs from "sql.js"
import { migrate } from "./migrate.client"
Expand Down Expand Up @@ -26,8 +27,7 @@ export const createSqljsQueryBuilder = async (db?: InitSqlJs.Database): Promise<
return db
},
onWrite: {
func: (buffer) => {
},
func: (buffer) => {},
isThrottle: true,
},
})
Expand All @@ -38,3 +38,21 @@ export const createSqljsQueryBuilder = async (db?: InitSqlJs.Database): Promise<

return createQueryBuilderWithDialect(dialect)
}

export const createDummyQueryBuilder = () => {
const dialect: Dialect = {
createAdapter() {
return new SqliteAdapter()
},
createDriver() {
return new DummyDriver()
},
createIntrospector(db: Kysely<unknown>) {
return new SqliteIntrospector(db)
},
createQueryCompiler() {
return new SqliteQueryCompiler()
},
}
return createQueryBuilderWithDialect(dialect)
}

0 comments on commit 4b48570

Please sign in to comment.