# pg-dbh

> PostgreSQL database pool holder

Latest version **1.1.0** (published 2018-03-07) · 0 weekly downloads

## Install

```sh
npm install pg-dbh
pnpm add pg-dbh
yarn add pg-dbh
bun add pg-dbh
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-03-07 |
| First published | 2018-03-07 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | temikng@gmail.com |
| Maintainers | temikn |

## Links

- npm: https://www.npmjs.com/package/pg-dbh
- npm.io page: https://npm.io/package/pg-dbh

## Recent versions

- 1.1.0 (latest) — 2018-03-07
- 1.0.0 — 2018-03-07

## README

# pg-dbh

PostgreSQL database pool holder

## Connection

```javascript
const pg = require('pg');
const pgDbhInit = require('pg-dbh');
const connect = { /* ... */ };
const params = { /* ... */ };
const dbh = pgDbhInit(pg, connect, params);
```

### - pg

user selected version of 
[pg package](https://github.com/brianc/node-postgres)

### - connect

the connection use 
[node-postgres](https://node-postgres.com/features/connecting#programmatic)
module

### - params

* logger - log function to output sql requests
* onError - handler function for pool on 'error' event

## Use

Full request
```javascript
const rows = await dbh(async (db) => {
    return await db.SelectAll('* FROM users WHERE role=$1', ['user']);
});
```
Short request
```javascript
const rows = await dbh.SelectAll('* FROM users WHERE role=$1', ['user']);
```

## Available functions

> will be soon

---
_Source: https://npm.io/package/pg-dbh · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
