File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
packages/dialect-bun-worker Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 26
26
"import" : " ./dist/index.mjs" ,
27
27
"require" : " ./dist/index.js"
28
28
},
29
+ "./normal" : {
30
+ "import" : " ./dist/normal.mjs" ,
31
+ "require" : " ./dist/normal.js"
32
+ },
29
33
"./worker" : {
30
34
"import" : " ./dist/worker.mjs" ,
31
35
"require" : " ./dist/worker.js"
36
40
"module" : " ./dist/index.mjs" ,
37
41
"typesVersions" : {
38
42
"*" : {
43
+ "normal" : [
44
+ " ./dist/normal.d.ts"
45
+ ],
39
46
"worker" : [
40
47
" ./dist/index.d.ts"
41
48
]
Original file line number Diff line number Diff line change
1
+ import type { BunSqliteDialectConfig } from './type'
2
+
3
+ import Database from 'bun:sqlite'
4
+ import { GenericSqliteDialect } from 'kysely-generic-sqlite'
5
+
6
+ import { createSqliteExecutor } from './worker/utils'
7
+
8
+ export class BunSqliteDialect extends GenericSqliteDialect {
9
+ constructor ( config ?: BunSqliteDialectConfig ) {
10
+ const {
11
+ url = ':memory:' ,
12
+ cacheStatment = false ,
13
+ onCreateConnection,
14
+ } = config || { }
15
+ super (
16
+ ( ) => createSqliteExecutor ( new Database ( url ) , cacheStatment ) ,
17
+ onCreateConnection ,
18
+ )
19
+ }
20
+ }
Original file line number Diff line number Diff line change @@ -22,3 +22,17 @@ export type InitData = {
22
22
fileName : string
23
23
cache : boolean
24
24
}
25
+
26
+ export interface BunSqliteDialectConfig extends IBaseSqliteDialectConfig {
27
+ /**
28
+ * db file path
29
+ *
30
+ * @default ':memory:'
31
+ */
32
+ url ?: string
33
+ /**
34
+ * use `bun:sqlite` built-in statment cache
35
+ * @see https://bun.sh/docs/api/sqlite#query
36
+ */
37
+ cacheStatment ?: boolean
38
+ }
You can’t perform that action at this time.
0 commit comments