@m2k-5f/pgtx 2.8.2 → 2.8.3
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 +19 -2
- package/dist/connection.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://github.com/M2K-5F/pgtx/actions/workflows/tests.yaml)
|
|
4
4
|
[](https://www.npmjs.com/package/@m2k-5f/pgtx)
|
|
5
5
|
|
|
6
|
-
A PostgreSQL driver for Node.js
|
|
6
|
+
A PostgreSQL driver for Node.js \| Bun. Built for regular applications, not for people who need four different flavors of the same stream implementation or a config object with forty optional fields you'll never touch.
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
9
|
npm install @m2k-5f/pgtx # npm
|
|
@@ -119,6 +119,23 @@ const [{ total }] = await pool.query<{
|
|
|
119
119
|
`
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
+
Validation happens before anything hits the socket. If a bound value doesn't match the
|
|
123
|
+
column's type, you get a `PostgresError` from the driver itself — not a round trip and a
|
|
124
|
+
server-side `invalid input syntax`:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
await pool.query`INSERT INTO users (age) VALUES (${"twenty"})`
|
|
128
|
+
// PostgresError: Bind error: Parameter $1 type mismatch.
|
|
129
|
+
// Expected PostgreSQL type "int4" (number (-2147483648..2147483647)), received: "twenty".
|
|
130
|
+
// code: '22000', dataType: 'int4'
|
|
131
|
+
// hint: Pass a value matching number (-2147483648..2147483647) for $1.
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The check is exact, not coercive — `1` is not a `bool`, `99999` is not an `int2`, and a
|
|
135
|
+
malformed UUID string is caught before it's encoded. Nothing is silently cast on your
|
|
136
|
+
behalf, so a type error is always your code's bug and never a value quietly changing shape
|
|
137
|
+
on the way to the database.
|
|
138
|
+
|
|
122
139
|
---
|
|
123
140
|
|
|
124
141
|
### Pipelining, by default
|
|
@@ -153,7 +170,7 @@ const { user, posts, ...data } = await Bind({
|
|
|
153
170
|
Errors don't leak across a batch, either. If one query in a pipelined group fails — a bad column, a constraint violation — only its own `Future` rejects; the others in the same batch still resolve normally with their own rows. Nothing gets rolled back or aborted on their account, because nothing tied them together in the first place beyond sharing a socket.
|
|
154
171
|
|
|
155
172
|
|
|
156
|
-
##
|
|
173
|
+
## Extra bits
|
|
157
174
|
|
|
158
175
|
### Transactions and savepoints
|
|
159
176
|
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiC,uBAAuB,EAAuC,GAAG,EAAiB,MAAM,SAAS,CAAA;AACzI,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAK3C,OAAO,EAAS,MAAM,EAAM,MAAM,eAAe,CAAA;AACjD,OAAO,EAA4E,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiC,uBAAuB,EAAuC,GAAG,EAAiB,MAAM,SAAS,CAAA;AACzI,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAK3C,OAAO,EAAS,MAAM,EAAM,MAAM,eAAe,CAAA;AACjD,OAAO,EAA4E,aAAa,EAAE,MAAM,SAAS,CAAA;AAejH;;;;;;;;;GASG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAA6B;IAE3C,OAAO,CAAC,QAAQ,CAAsD;IACtE,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,aAAa,CAA2C;IAChE,OAAO,CAAC,cAAc,CAAQ;I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