@tishlang/pg 1.9.0

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,7 @@
1
+ # @tishlang/pg
2
+
3
+ PostgreSQL for **Tish** native programs: pool or per-worker client, prepared statements, pipelined `queryAll`, and a small migrations runner.
4
+
5
+ Requires the **`pg`** feature on the `tish` CLI (included in default `full`). Install from npm and import from `@tishlang/pg`.
6
+
7
+ See [tishlang.com docs](https://tishlang.com/docs/features/pg/) and the crate source at [`crates/tish_pg`](https://github.com/tishlang/tish/tree/main/crates/tish_pg).
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@tishlang/pg",
3
+ "version": "1.9.0",
4
+ "description": "PostgreSQL driver for Tish (Rust-backed via tishlang_pg).",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/tishlang/tish.git",
9
+ "directory": "npm/pg"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "tish": {
15
+ "module": "./src/index.tish",
16
+ "rustDependencies": {
17
+ "tishlang_pg": {
18
+ "package": "tishlang_pg",
19
+ "version": ">=0.1"
20
+ }
21
+ }
22
+ },
23
+ "main": "./src/index.tish",
24
+ "exports": {
25
+ ".": {
26
+ "tish": "./src/index.tish",
27
+ "default": "./src/index.tish"
28
+ }
29
+ },
30
+ "files": [
31
+ "src/",
32
+ "README.md"
33
+ ],
34
+ "keywords": [
35
+ "tish",
36
+ "postgres",
37
+ "postgresql",
38
+ "tokio-postgres"
39
+ ]
40
+ }
package/src/index.tish ADDED
@@ -0,0 +1,36 @@
1
+ // @tishlang/pg — public Tish API.
2
+ //
3
+ // Postgres connection (pool or per-worker client), prepared statements,
4
+ // pipelined batch queries, and a tiny migrations runner.
5
+ //
6
+ // const client = perWorkerClient(connectionString)
7
+ // const stmt = prepare(client, 'SELECT id, message FROM fortune')
8
+ // const rows = queryPrepared(client, stmt, [])
9
+ //
10
+ // // Many queries pipelined on one client (concurrent on the wire,
11
+ // // sequential on the server side):
12
+ // const results = queryAll(client, [
13
+ // [stmt1, [1]],
14
+ // [stmt1, [2]],
15
+ // ])
16
+ //
17
+ // // Idempotent migrations from a directory of *.sql files:
18
+ // migrate(client, './migrations')
19
+
20
+ import {
21
+ per_worker_client as _perWorkerClient,
22
+ connect as _connect,
23
+ prepare as _prepare,
24
+ query_prepared as _queryPrepared,
25
+ query_all as _queryAll,
26
+ migrate as _migrate,
27
+ close as _close
28
+ } from 'cargo:tish_pg'
29
+
30
+ export const perWorkerClient = _perWorkerClient
31
+ export const connect = _connect
32
+ export const prepare = _prepare
33
+ export const queryPrepared = _queryPrepared
34
+ export const queryAll = _queryAll
35
+ export const migrate = _migrate
36
+ export const close = _close