https://github.com/pasupulaphani/node-pg-connection-pool
Simplistic node postgres connection pool ready to scale
https://github.com/pasupulaphani/node-pg-connection-pool
database native-bindings-support pg-connection-pool postgres-connection-pool
Last synced: about 2 months ago
JSON representation
Simplistic node postgres connection pool ready to scale
- Host: GitHub
- URL: https://github.com/pasupulaphani/node-pg-connection-pool
- Owner: pasupulaphani
- License: mit
- Created: 2017-02-09T19:55:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-06-20T22:26:35.000Z (about 3 years ago)
- Last Synced: 2025-09-24T04:38:34.494Z (10 months ago)
- Topics: database, native-bindings-support, pg-connection-pool, postgres-connection-pool
- Language: JavaScript
- Homepage: https://pasupulaphani.github.io/node-pg-connection-pool/
- Size: 115 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://badge.fury.io/js/node-pg-connection-pool)
[](https://travis-ci.org/pasupulaphani/node-pg-connection-pool)
[](https://coveralls.io/github/pasupulaphani/node-pg-connection-pool?branch=master)
[](https://www.versioneye.com/user/projects/58780c851fe8e3003e7a83b2)
[](https://gratipay.com/simple-redis-store/)
# node-pg-connection-pool [](https://github.com/pasupulaphani/node-pg-connection-pool)
Simplistic node postgres connection pool ready can scale with generic-pool support
## Prerequisites
```node >= 4``` This module requires nodejs v4 or above as it has dependencies on es6 components such as Map, Set, Promise etc.
### Getting started
```
npm install node-pg-connection-pool
```
#### Usage
- Seemless execution of commands.
```
var PgPool = require("node-pg-connection-pool");
var pool = new PgPool();
const result = await pool.query("SELECT $1::int AS number;", ["1"]);
```
- Want postgres raw connection? you got it
```
pool.acquire()
.then(client => {
// Do some work
// At the end release the conn back to the pool
pool.release(client)
});
```
#### API
- PgPool([options])
##### `options` object properties
Name
Type
Description
name
string
Name your pool
pgOptions
object
opts from node-postgres#client-parameters
pgNative
boolean
Use the native bindings. Install pg-native in your app before setting this to true.
poolOptions
object
opts from node-pool#createpool
logger
object
Inject your custom logger
### Run tests
sh test.sh
## Contribute
[Discover how you can contribute by heading on over to the `CONTRIBUTING.md` file.](https://github.com/pasupulaphani/node-pg-connection-pool/blob/master/CONTRIBUTING.md)
## Backers
### Maintainers
These amazing people are maintaining this project:
* [Phani](https://github.com/pasupulaphani) — [view contributions](https://github.com/pasupulaphani/node-pg-connection-pool/commits?author=pasupulaphani)
### Sponsors
No sponsors yet! Will you be the first?
[](http://patreon.com/phaninder "Donate to this project using Patreon")
[](https://gratipay.com/~pasupulaphani/ "Donate weekly to this project using Gratipay")
[](https://flattr.com/profile/pasupulaphani "Donate to this project using Flattr")
### Contributors
These amazing people have contributed to/reviewed this project:
* [Oliver Brooks](https://github.com/oliverbrooks)
[Discover how you can contribute by heading on over to the `CONTRIBUTING.md` file.](https://github.com/pasupulaphani/node-pg-connection-pool/blob/master/CONTRIBUTING.md)
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');ga('create', 'UA-57413413-7', 'auto');ga('send', 'pageview');
---
