@mountsqli/pg 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 +63 -0
- package/package.json +12 -4
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @mountsqli/pg
|
|
2
|
+
|
|
3
|
+
PostgreSQL dialect for MountSQLi with support for node-postgres and postgres.js drivers.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Type-safe PostgreSQL queries
|
|
8
|
+
- Multiple driver support (node-postgres, postgres.js)
|
|
9
|
+
- JSONB operations
|
|
10
|
+
- Array types
|
|
11
|
+
- Full-text search
|
|
12
|
+
- Window functions
|
|
13
|
+
- Transaction support with isolation levels
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @mountsqli/pg
|
|
19
|
+
|
|
20
|
+
# Install a driver (pick one)
|
|
21
|
+
npm install pg # node-postgres
|
|
22
|
+
# or
|
|
23
|
+
npm install postgres # postgres.js
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { mountsqli } from '@mountsqli/pg/node-postgres';
|
|
30
|
+
import { pgTable, uuid, text, boolean, timestamp } from '@mountsqli/pg';
|
|
31
|
+
|
|
32
|
+
// Define schema
|
|
33
|
+
const users = pgTable('users', {
|
|
34
|
+
id: uuid('id').defaultRandom().primaryKey(),
|
|
35
|
+
name: text('name').notNull(),
|
|
36
|
+
email: text('email').notNull().unique(),
|
|
37
|
+
active: boolean('active').default(true).notNull(),
|
|
38
|
+
createdAt: timestamp('created_at').defaultNow().notNull(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Connect
|
|
42
|
+
const db = mountsqli('postgresql://user:pass@localhost:5432/mydb');
|
|
43
|
+
|
|
44
|
+
// Query with full type safety
|
|
45
|
+
const activeUsers = await db.select()
|
|
46
|
+
.from(users)
|
|
47
|
+
.where(eq(users.active, true));
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Drivers
|
|
51
|
+
|
|
52
|
+
| Driver | Package | Best For |
|
|
53
|
+
|--------|---------|----------|
|
|
54
|
+
| node-postgres | `pg` | General purpose, most stable |
|
|
55
|
+
| postgres.js | `postgres` | Edge runtime, Deno, Bun |
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
|
|
59
|
+
📖 [Documentation](https://mountsqli.dev/docs/pg/setup)
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mountsqli/pg",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
"main": "./dist/index.js",
|
|
20
20
|
"types": "./dist/index.d.ts",
|
|
21
21
|
"sideEffects": false,
|
|
22
|
-
"files": [
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
23
27
|
"scripts": {
|
|
24
28
|
"build": "tsup src/index.ts src/drivers/node-postgres/index.ts src/drivers/postgres-js/index.ts --format esm --dts --clean",
|
|
25
29
|
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
@@ -34,8 +38,12 @@
|
|
|
34
38
|
"postgres": "^3.0.0"
|
|
35
39
|
},
|
|
36
40
|
"peerDependenciesMeta": {
|
|
37
|
-
"pg": {
|
|
38
|
-
|
|
41
|
+
"pg": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"postgres": {
|
|
45
|
+
"optional": true
|
|
46
|
+
}
|
|
39
47
|
},
|
|
40
48
|
"devDependencies": {
|
|
41
49
|
"typescript": "^5.7.0",
|