@atscript/db-postgres 0.1.38 → 0.1.39
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 +59 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://atscript.moost.org/logo.svg" alt="Atscript" width="120" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">@atscript/db-postgres</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Define your models once</strong> — get TypeScript types, runtime validation, and DB metadata from a single <code>.as</code> model.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://atscript.moost.org">Documentation</a> · <a href="https://atscript.moost.org/db/adapters/postgresql">PostgreSQL Adapter</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
PostgreSQL adapter for `@atscript/db` using the `pg` (node-postgres) driver. Full-featured with pgvector, CITEXT, GIN fulltext, HNSW indexes, transactional DDL, and batched inserts with RETURNING.
|
|
18
|
+
|
|
19
|
+
Includes `PostgresPlugin` for `@db.pg.*` annotations (type overrides, schema selection, native collation).
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add @atscript/db-postgres pg
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { DbSpace } from '@atscript/db'
|
|
31
|
+
import { createAdapter } from '@atscript/db-postgres'
|
|
32
|
+
|
|
33
|
+
const db = createAdapter('postgresql://user@localhost:5432/mydb')
|
|
34
|
+
const users = db.getTable(UsersType)
|
|
35
|
+
|
|
36
|
+
await users.insertOne({ name: 'Alice', email: 'alice@example.com' })
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- Full CRUD with batched multi-row INSERT + RETURNING (auto-chunking at ~65K params)
|
|
42
|
+
- pgvector: HNSW indexes with cosine, euclidean, and dot product similarity
|
|
43
|
+
- CITEXT for case-insensitive text via `@db.collate "nocase"`
|
|
44
|
+
- GIN fulltext search via `tsvector` / `tsquery` with ranking
|
|
45
|
+
- GENERATED BY DEFAULT AS IDENTITY for auto-increment
|
|
46
|
+
- Native UUID generation via `gen_random_uuid()`
|
|
47
|
+
- Schema selection via `@db.pg.schema`
|
|
48
|
+
- Transactional DDL — schema sync is fully atomic
|
|
49
|
+
- Foreign key constraints with referential actions
|
|
50
|
+
- Full schema sync: CREATE, ALTER, DROP, indexes, views
|
|
51
|
+
|
|
52
|
+
## Documentation
|
|
53
|
+
|
|
54
|
+
- [PostgreSQL Adapter Guide](https://atscript.moost.org/db/adapters/postgresql)
|
|
55
|
+
- [Full Documentation](https://atscript.moost.org)
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/db-postgres",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"description": "PostgreSQL adapter for @atscript/db with pg (node-postgres) driver support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atscript",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@uniqu/core": "^0.1.2",
|
|
59
59
|
"pg": ">=8.0.0",
|
|
60
|
-
"@atscript/db": "^0.1.
|
|
61
|
-
"@atscript/
|
|
62
|
-
"@atscript/core": "^0.1.
|
|
63
|
-
"@atscript/
|
|
60
|
+
"@atscript/db-sql-tools": "^0.1.39",
|
|
61
|
+
"@atscript/db": "^0.1.39",
|
|
62
|
+
"@atscript/core": "^0.1.39",
|
|
63
|
+
"@atscript/typescript": "^0.1.39"
|
|
64
64
|
},
|
|
65
65
|
"peerDependenciesMeta": {
|
|
66
66
|
"pg": {
|