# pg-params

> pg doesn't support named parameters, to keep things lightweight and simple. However, that makes queries brittle.

Latest version **2.0.2** (published 2021-10-31) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2021-10-31 |
| First published | 2018-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jeswin Kumar |
| Maintainers | jeswin |

## Links

- npm: https://www.npmjs.com/package/pg-params
- Repository: https://github.com/jeswin/pg-params
- Homepage: https://github.com/jeswin/pg-params#readme
- Issues: https://github.com/jeswin/pg-params/issues
- npm.io page: https://npm.io/package/pg-params

## Recent versions

- 2.0.2 (latest) — 2021-10-31
- 2.0.1 — 2021-10-31
- 2.0.0 — 2021-09-25
- 1.0.7 — 2021-09-25
- 1.0.5 — 2021-04-05
- 1.0.4 — 2021-03-28
- 1.0.3 — 2020-08-13
- 1.0.2 — 2020-05-02
- 1.0.1 — 2019-06-21
- 1.0.0 — 2019-06-21
- 0.0.7 — 2018-08-16
- 0.0.6 — 2018-06-24
- 0.0.5 — 2018-06-24
- 0.0.4 — 2018-06-21
- 0.0.3 — 2018-06-21
- … 2 more at https://npm.io/package/pg-params/versions

## README

# pg-params

pg doesn't support named parameters, to keep things lightweight and simple.
However, that makes queries brittle.

pg-params contains helper methods to make parameterized queries easier.

## Installation

```bash
npm install pg-params
```

## Usage

Here's an example.

```js
import Params from "pg-params";

const params = Params({
  name: "jeswin",
  country: "india"
});

const queryText = `
  SELECT * FROM user WHERE 
  name=${dbParams.id("name")} AND 
  country=${dbParams.id("country")}`;

client.query(queryText, dbParams.values());
```

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