@kozojs/db 0.1.4 → 0.1.6

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.
Files changed (2) hide show
  1. package/README.md +59 -0
  2. package/package.json +41 -41
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # @kozojs/db
2
+
3
+ Drizzle ORM integration for [Kozo Framework](https://github.com/kozojs/kozo).
4
+ Supports PostgreSQL, MySQL, and SQLite with a single unified API.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install @kozojs/db drizzle-orm
10
+ ```
11
+
12
+ ## Quick Start
13
+
14
+ ```typescript
15
+ import { createDatabase } from '@kozojs/db';
16
+ import { createKozo } from '@kozojs/core';
17
+
18
+ const db = await createDatabase({
19
+ provider: 'postgresql',
20
+ url: process.env.DATABASE_URL,
21
+ schema: { users },
22
+ });
23
+
24
+ const app = createKozo({ services: { db } });
25
+
26
+ app.get('/users', {}, (c) => c.services.db.query.users.findMany());
27
+
28
+ await app.nativeListen(3000);
29
+ ```
30
+
31
+ ## Supported Providers
32
+
33
+ | Provider | Config |
34
+ |---|---|
35
+ | **PostgreSQL** | `{ provider: 'postgresql', url: 'postgres://...' }` |
36
+ | **MySQL** | `{ provider: 'mysql', url: 'mysql://...' }` |
37
+ | **SQLite** | `{ provider: 'sqlite', file: './db.sqlite' }` |
38
+
39
+ ## Testing
40
+
41
+ ```typescript
42
+ import { createTestDatabase } from '@kozojs/db';
43
+
44
+ // In-memory SQLite — no setup needed
45
+ const db = createTestDatabase(schema);
46
+ ```
47
+
48
+ ## Re-exports
49
+
50
+ All common Drizzle utilities are re-exported for convenience:
51
+
52
+ ```typescript
53
+ import { sql, eq, and, or, desc, asc } from '@kozojs/db';
54
+ import { createInsertSchema, createSelectSchema } from '@kozojs/db';
55
+ ```
56
+
57
+ ## License
58
+
59
+ MIT
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "name": "@kozojs/db",
3
- "version": "0.1.4",
4
- "description": "Database utilities for Kozo Framework - Drizzle ORM integration",
5
- "type": "module",
6
- "license": "MIT",
7
- "author": "Kozo Team",
8
- "files": [
9
- "lib",
10
- "README.md"
11
- ],
12
- "main": "./lib/index.js",
13
- "types": "./lib/index.d.ts",
14
- "exports": {
15
- ".": {
16
- "import": "./lib/index.js",
17
- "types": "./lib/index.d.ts"
18
- }
19
- },
20
- "scripts": {
21
- "build": "tsup",
22
- "dev": "tsup --watch"
23
- },
24
- "dependencies": {
25
- "drizzle-orm": "^0.36.0",
26
- "drizzle-zod": "^0.5.1",
27
- "postgres": "^3.4.0",
28
- "mysql2": "^3.11.0",
29
- "better-sqlite3": "^11.0.0"
30
- },
31
- "devDependencies": {
32
- "@types/better-sqlite3": "^7.6.0",
33
- "@types/node": "^22.0.0",
34
- "drizzle-kit": "^0.28.0",
35
- "tsup": "^8.3.0",
36
- "typescript": "^5.6.0"
37
- },
38
- "peerDependencies": {
39
- "zod": "^3.23.0"
40
- }
41
- }
1
+ {
2
+ "name": "@kozojs/db",
3
+ "version": "0.1.6",
4
+ "description": "Database utilities for Kozo Framework - Drizzle ORM integration",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Kozo Team",
8
+ "files": [
9
+ "lib",
10
+ "README.md"
11
+ ],
12
+ "main": "./lib/index.js",
13
+ "types": "./lib/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./lib/index.js",
17
+ "types": "./lib/index.d.ts"
18
+ }
19
+ },
20
+ "dependencies": {
21
+ "drizzle-orm": "^0.36.0",
22
+ "drizzle-zod": "^0.5.1",
23
+ "postgres": "^3.4.0",
24
+ "mysql2": "^3.11.0",
25
+ "better-sqlite3": "^11.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/better-sqlite3": "^7.6.0",
29
+ "@types/node": "^22.0.0",
30
+ "drizzle-kit": "^0.28.0",
31
+ "tsup": "^8.3.0",
32
+ "typescript": "^5.6.0"
33
+ },
34
+ "peerDependencies": {
35
+ "zod": "^3.23.0"
36
+ },
37
+ "scripts": {
38
+ "build": "tsup",
39
+ "dev": "tsup --watch"
40
+ }
41
+ }