@syncular/dialect-better-sqlite3 0.0.6-73 → 0.0.6-79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/index.d.ts +1 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -20
package/README.md
CHANGED
|
@@ -11,9 +11,13 @@ npm install @syncular/dialect-better-sqlite3
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
import {
|
|
14
|
+
import { createDatabase } from '@syncular/core';
|
|
15
|
+
import { createBetterSqlite3Dialect } from '@syncular/dialect-better-sqlite3';
|
|
15
16
|
|
|
16
|
-
const db =
|
|
17
|
+
const db = createDatabase<MyDb>({
|
|
18
|
+
dialect: createBetterSqlite3Dialect({ path: './app.sqlite' }),
|
|
19
|
+
family: 'sqlite',
|
|
20
|
+
});
|
|
17
21
|
```
|
|
18
22
|
|
|
19
23
|
## Documentation
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* SQLite-compatible — use with @syncular/server-dialect-sqlite.
|
|
6
6
|
*/
|
|
7
7
|
import type { Database as BetterSqlite3Database } from 'better-sqlite3';
|
|
8
|
-
import {
|
|
8
|
+
import { SqliteDialect } from 'kysely';
|
|
9
9
|
export interface BetterSqlite3PathOptions {
|
|
10
10
|
/** Path to SQLite database file, or ':memory:' for in-memory */
|
|
11
11
|
path: string;
|
|
@@ -15,18 +15,6 @@ export interface BetterSqlite3InstanceOptions {
|
|
|
15
15
|
database: BetterSqlite3Database;
|
|
16
16
|
}
|
|
17
17
|
export type BetterSqlite3Options = BetterSqlite3PathOptions | BetterSqlite3InstanceOptions;
|
|
18
|
-
/**
|
|
19
|
-
* Create a Kysely instance with better-sqlite3 dialect.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* const db = createBetterSqlite3Db<MyDb>({ path: './data.db' });
|
|
23
|
-
* const db = createBetterSqlite3Db<MyDb>({ path: ':memory:' });
|
|
24
|
-
*
|
|
25
|
-
* // Existing instance
|
|
26
|
-
* import Database from 'better-sqlite3';
|
|
27
|
-
* const db = createBetterSqlite3Db<MyDb>({ database: new Database(':memory:') });
|
|
28
|
-
*/
|
|
29
|
-
export declare function createBetterSqlite3Db<T>(options: BetterSqlite3Options): Kysely<T>;
|
|
30
18
|
/**
|
|
31
19
|
* Create the better-sqlite3 dialect directly.
|
|
32
20
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,WAAW,wBAAwB;IACvC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,4BAA4B;IAC3C,mDAAmD;IACnD,QAAQ,EAAE,qBAAqB,CAAC;CACjC;AAED,MAAM,MAAM,oBAAoB,GAC5B,wBAAwB,GACxB,4BAA4B,CAAC;AAEjC;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,oBAAoB,GAC5B,aAAa,CAIf"}
|
package/dist/index.js
CHANGED
|
@@ -5,23 +5,7 @@
|
|
|
5
5
|
* SQLite-compatible — use with @syncular/server-dialect-sqlite.
|
|
6
6
|
*/
|
|
7
7
|
import Database from 'better-sqlite3';
|
|
8
|
-
import {
|
|
9
|
-
/**
|
|
10
|
-
* Create a Kysely instance with better-sqlite3 dialect.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* const db = createBetterSqlite3Db<MyDb>({ path: './data.db' });
|
|
14
|
-
* const db = createBetterSqlite3Db<MyDb>({ path: ':memory:' });
|
|
15
|
-
*
|
|
16
|
-
* // Existing instance
|
|
17
|
-
* import Database from 'better-sqlite3';
|
|
18
|
-
* const db = createBetterSqlite3Db<MyDb>({ database: new Database(':memory:') });
|
|
19
|
-
*/
|
|
20
|
-
export function createBetterSqlite3Db(options) {
|
|
21
|
-
return new Kysely({
|
|
22
|
-
dialect: createBetterSqlite3Dialect(options),
|
|
23
|
-
});
|
|
24
|
-
}
|
|
8
|
+
import { SqliteDialect } from 'kysely';
|
|
25
9
|
/**
|
|
26
10
|
* Create the better-sqlite3 dialect directly.
|
|
27
11
|
*/
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAgBvC;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAA6B,EACd;IACf,MAAM,QAAQ,GACZ,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,OAAO,IAAI,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;AAAA,CACxC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import type { Database as BetterSqlite3Database } from 'better-sqlite3';
|
|
9
9
|
import Database from 'better-sqlite3';
|
|
10
|
-
import {
|
|
10
|
+
import { SqliteDialect } from 'kysely';
|
|
11
11
|
|
|
12
12
|
export interface BetterSqlite3PathOptions {
|
|
13
13
|
/** Path to SQLite database file, or ':memory:' for in-memory */
|
|
@@ -23,25 +23,6 @@ export type BetterSqlite3Options =
|
|
|
23
23
|
| BetterSqlite3PathOptions
|
|
24
24
|
| BetterSqlite3InstanceOptions;
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* Create a Kysely instance with better-sqlite3 dialect.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* const db = createBetterSqlite3Db<MyDb>({ path: './data.db' });
|
|
31
|
-
* const db = createBetterSqlite3Db<MyDb>({ path: ':memory:' });
|
|
32
|
-
*
|
|
33
|
-
* // Existing instance
|
|
34
|
-
* import Database from 'better-sqlite3';
|
|
35
|
-
* const db = createBetterSqlite3Db<MyDb>({ database: new Database(':memory:') });
|
|
36
|
-
*/
|
|
37
|
-
export function createBetterSqlite3Db<T>(
|
|
38
|
-
options: BetterSqlite3Options
|
|
39
|
-
): Kysely<T> {
|
|
40
|
-
return new Kysely<T>({
|
|
41
|
-
dialect: createBetterSqlite3Dialect(options),
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
26
|
/**
|
|
46
27
|
* Create the better-sqlite3 dialect directly.
|
|
47
28
|
*/
|