@mountsqli/sqlite 0.1.0 → 0.1.1
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 +61 -0
- package/package.json +9 -3
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @mountsqli/sqlite
|
|
2
|
+
|
|
3
|
+
SQLite dialect for MountSQLi with better-sqlite3 driver support.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Type-safe SQLite queries
|
|
8
|
+
- In-memory database support
|
|
9
|
+
- Auto-increment primary keys
|
|
10
|
+
- Boolean as integer
|
|
11
|
+
- Timestamp as integer
|
|
12
|
+
- Transaction support with savepoints
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @mountsqli/sqlite better-sqlite3
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { mountsqli } from '@mountsqli/sqlite/better-sqlite3';
|
|
24
|
+
import { sqliteTable, integer, text } from '@mountsqli/sqlite';
|
|
25
|
+
|
|
26
|
+
// Define schema
|
|
27
|
+
const users = sqliteTable('users', {
|
|
28
|
+
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
29
|
+
name: text('name').notNull(),
|
|
30
|
+
email: text('email').notNull().unique(),
|
|
31
|
+
active: integer('active', { mode: 'boolean' }).default(true).notNull(),
|
|
32
|
+
createdAt: integer('created_at', { mode: 'timestamp' }).defaultNow().notNull(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Connect (file database)
|
|
36
|
+
const db = mountsqli('./mydb.sqlite');
|
|
37
|
+
|
|
38
|
+
// Or in-memory database
|
|
39
|
+
const db = mountsqli(':memory:');
|
|
40
|
+
|
|
41
|
+
// Query with full type safety
|
|
42
|
+
const activeUsers = await db.select()
|
|
43
|
+
.from(users)
|
|
44
|
+
.where(eq(users.active, true));
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Use Cases
|
|
48
|
+
|
|
49
|
+
- **Local development** — No database server needed
|
|
50
|
+
- **Testing** — Fast, in-memory databases
|
|
51
|
+
- **Mobile apps** — Embedded database
|
|
52
|
+
- **Desktop applications** — Embedded database
|
|
53
|
+
- **Serverless** — Cloudflare D1, Vercel Edge
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
📖 [Documentation](https://mountsqli.dev/docs/sqlite/setup)
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mountsqli/sqlite",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"main": "./dist/index.js",
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
|
-
"files": [
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
18
22
|
"scripts": {
|
|
19
23
|
"build": "tsup src/index.ts src/drivers/better-sqlite3/index.ts --format esm --dts --clean",
|
|
20
24
|
"dev": "tsup --watch",
|
|
@@ -28,7 +32,9 @@
|
|
|
28
32
|
"better-sqlite3": "^11.0.0"
|
|
29
33
|
},
|
|
30
34
|
"peerDependenciesMeta": {
|
|
31
|
-
"better-sqlite3": {
|
|
35
|
+
"better-sqlite3": {
|
|
36
|
+
"optional": true
|
|
37
|
+
}
|
|
32
38
|
},
|
|
33
39
|
"devDependencies": {
|
|
34
40
|
"@types/node": "^22.0.0",
|