Skip to content

Commit 5acbc49

Browse files
committed
Fixed deprecation warning
1 parent 175606a commit 5acbc49

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ await pgvector.registerTypes(client);
6363
or a pool
6464

6565
```javascript
66-
pool.on('connect', async function (client) {
67-
await pgvector.registerTypes(client);
68-
});
66+
new pg.Pool({onConnect: async (client) => await pgvector.registerType(client)});
6967
```
7068

7169
Create a table

tests/pg.test.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ test('pg example', async () => {
3535
});
3636

3737
test('pool', async () => {
38-
const pool = new pg.Pool({database: 'pgvector_node_test'});
39-
pool.on('connect', async function (client) {
40-
await client.query('CREATE EXTENSION IF NOT EXISTS vector');
41-
await pgvector.registerType(client);
38+
const pool = new pg.Pool({
39+
database: 'pgvector_node_test',
40+
onConnect: async (client) => {
41+
await client.query('CREATE EXTENSION IF NOT EXISTS vector');
42+
await pgvector.registerType(client);
43+
}
4244
});
4345

4446
await pool.query('DROP TABLE IF EXISTS pg_items');

0 commit comments

Comments
 (0)