@atscript/db-postgres 0.1.38 → 0.1.40

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 ADDED
@@ -0,0 +1,59 @@
1
+ <p align="center">
2
+ <img src="https://atscript.dev/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://db.atscript.dev">Documentation</a> · <a href="https://db.atscript.dev/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://db.atscript.dev/adapters/postgresql)
55
+ - [Full Documentation](https://db.atscript.dev)
56
+
57
+ ## License
58
+
59
+ MIT
@@ -0,0 +1,6 @@
1
+ import { TAtscriptPlugin } from "@atscript/core";
2
+
3
+ //#region src/plugin/index.d.ts
4
+ declare const PostgresPlugin: () => TAtscriptPlugin;
5
+ //#endregion
6
+ export { PostgresPlugin as t };
@@ -0,0 +1,6 @@
1
+ import { TAtscriptPlugin } from "@atscript/core";
2
+
3
+ //#region src/plugin/index.d.ts
4
+ declare const PostgresPlugin: () => TAtscriptPlugin;
5
+ //#endregion
6
+ export { PostgresPlugin as t };