Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postgresql-client

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postgresql-client - npm Package Compare versions

Comparing version 2.5.3 to 2.5.5

CHANGELOG.md

17

package.json
{
"name": "postgresql-client",
"description": "Enterprise level PostgreSQL client for JavaScript",
"version": "2.5.3",
"version": "2.5.5",
"author": "Panates",

@@ -29,4 +29,5 @@ "contributors": [

"@types/node": "^18.14.0",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"auto-changelog": "^2.4.0",
"dotenv": "^16.0.3",

@@ -63,3 +64,4 @@ "eslint": "^8.34.0",

"precitest": "rimraf coverage",
"citest": "jest --coverage --coverageReporters=lcov"
"citest": "jest --coverage --coverageReporters=lcov",
"version": "auto-changelog -p && git add CHANGELOG.md"
},

@@ -84,8 +86,11 @@ "type": "module",

"LICENSE",
"README.md"
"README.md",
"CHANGELOG.md"
],
"keywords": [
"pg",
"backend",
"frontent",
"postgresql",
"postgres",
"pg",
"postgre",

@@ -92,0 +97,0 @@ "driver",

@@ -50,10 +50,16 @@ ## postgresql-client

import {Connection} from 'postgresql-client';
// Create connection
const connection = new Connection('postgres://localhost');
// Connect to database server
await connection.connect();
// Execute query and fetch rows
const result = await connection.query(
'select * from cities where name like $1',
{params: ['%york%']});
const rows = result.rows;
await connection.close(); // Disconnect
const rows: any[] = result.rows;
// Do what ever you want with rows
// Disconnect from server
await connection.close();
```

@@ -65,2 +71,3 @@

// Create connection pool
const db = new Pool({

@@ -75,12 +82,18 @@ host: 'postgres://localhost',

// Execute query and fetch cursor
const result = await db.query(
'select * from cities where name like $1',
{params: ['%york%'], cursor: true});
// Walk through the cursor, and do whatever you want with fetched rows
const cursor = result.cursor;
let row;
while ((row = cursor.next())) {
while ((row = await cursor.next())) {
console.log(row);
}
// Close cursor, (Send connection back to the pool)
await cursor.close();
await db.close(); // Disconnect all connections and shutdown pool
// Disconnect all connections and shutdown pool
await db.close();
```

@@ -87,0 +100,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc