Skip to content

Commit 5a2a6aa

Browse files
authored
chore: update to v0.10.2 (#114)
1 parent eff8139 commit 5a2a6aa

File tree

7 files changed

+56
-6
lines changed

7 files changed

+56
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## UNRELEASED
1+
## 0.10.2 (2024-11-05)
22

3-
expose types property on public HTTPQueryOptions type
3+
Expose `types` property on public HTTPQueryOptions type
44

55
## 0.10.1 (2024-10-07)
66

CONFIG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,29 @@ const rows = await sql('SELECT * FROM posts WHERE id = $1', [postId], {
108108
clearTimeout(timeout);
109109
```
110110

111+
### `types: typeof PgTypes`
112+
113+
The `types` option can be passed to `neon(...)` to override the default PostgreSQL type parsers provided by `PgTypes`. This is useful if you want to define custom parsing behavior for specific PostgreSQL data types, allowing you to control how data is converted when retrieved from the database. Learn more in the [PgTypes official documentation](https://github.com/brianc/node-pg-types).
114+
115+
Example of usage:
116+
117+
```typescript
118+
import PgTypes from 'pg-types';
119+
import { neon } from '@neondatabase/serverless';
120+
121+
// Define custom parsers for specific PostgreSQL types
122+
// Parse PostgreSQL `DATE` fields as JavaScript `Date` objects
123+
PgTypes.setTypeParser(PgTypes.builtins.DATE, (val) => new Date(val));
124+
125+
// Parse PostgreSQL `NUMERIC` fields as JavaScript `float` values
126+
PgTypes.setTypeParser(PgTypes.builtins.NUMERIC, parseFloat);
127+
128+
// Configure the Neon client with the custom `types` parser
129+
const sql = neon(process.env.DATABASE_URL, {
130+
types: PgTypes, // Pass in the custom PgTypes object here
131+
});
132+
```
133+
111134
### `authToken: string | (() => Promise<string> | string)`
112135

113136
The `authToken` option can be passed to `neon(...)` to set the `Authorization` header for the `fetch` request. This allows you to authenticate database requests against third-party authentication providers. So, this mechanism can be used to ensure that access control and authorization are managed effectively across different systems.

dist/jsr/jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@neon/serverless",
3-
"version": "0.10.1",
3+
"version": "0.10.2",
44
"exports": "./index.js",
55
"imports": {
66
"pg": "npm:@types/pg@8.11.6"

dist/npm/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.10.2 (2024-11-05)
2+
3+
Expose `types` property on public HTTPQueryOptions type
4+
15
## 0.10.1 (2024-10-07)
26

37
Fix `CONFIG.MD` documentation.

dist/npm/CONFIG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,29 @@ const rows = await sql('SELECT * FROM posts WHERE id = $1', [postId], {
108108
clearTimeout(timeout);
109109
```
110110

111+
### `types: typeof PgTypes`
112+
113+
The `types` option can be passed to `neon(...)` to override the default PostgreSQL type parsers provided by `PgTypes`. This is useful if you want to define custom parsing behavior for specific PostgreSQL data types, allowing you to control how data is converted when retrieved from the database. Learn more in the [PgTypes official documentation](https://github.com/brianc/node-pg-types).
114+
115+
Example of usage:
116+
117+
```typescript
118+
import PgTypes from 'pg-types';
119+
import { neon } from '@neondatabase/serverless';
120+
121+
// Define custom parsers for specific PostgreSQL types
122+
// Parse PostgreSQL `DATE` fields as JavaScript `Date` objects
123+
PgTypes.setTypeParser(PgTypes.builtins.DATE, (val) => new Date(val));
124+
125+
// Parse PostgreSQL `NUMERIC` fields as JavaScript `float` values
126+
PgTypes.setTypeParser(PgTypes.builtins.NUMERIC, parseFloat);
127+
128+
// Configure the Neon client with the custom `types` parser
129+
const sql = neon(process.env.DATABASE_URL, {
130+
types: PgTypes, // Pass in the custom PgTypes object here
131+
});
132+
```
133+
111134
### `authToken: string | (() => Promise<string> | string)`
112135

113136
The `authToken` option can be passed to `neon(...)` to set the `Authorization` header for the `fetch` request. This allows you to authenticate database requests against third-party authentication providers. So, this mechanism can be used to ensure that access control and authorization are managed effectively across different systems.

dist/npm/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/npm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@neondatabase/serverless",
3-
"version": "0.10.1",
3+
"version": "0.10.2",
44
"author": "Neon",
55
"description": "node-postgres for serverless environments from neon.tech",
66
"exports": {

0 commit comments

Comments
 (0)