# @cuillere/postgres

Latest version **0.13.1** (published 2022-10-09) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @cuillere/postgres
pnpm add @cuillere/postgres
yarn add @cuillere/postgres
bun add @cuillere/postgres
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.13.1 |
| Published | 2022-10-09 |
| First published | 2019-07-25 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 72.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Valentin COCAUD |
| Maintainers | emrys-myrddin, nicolas.lepage |

## Links

- npm: https://www.npmjs.com/package/@cuillere/postgres
- Repository: https://github.com/cuillerejs/cuillere
- npm.io page: https://npm.io/package/@cuillere/postgres

## Recent versions

- 0.13.1 (latest) — 2022-10-09
- 0.14.0-alpha.0 (alpha) — 2022-04-09
- 0.13.0 — 2021-05-12
- 0.13.0-alpha.2 — 2021-05-11
- 0.12.0 — 2021-01-08
- 0.12.0-alpha.4 — 2020-11-18
- 0.12.0-alpha.3 — 2020-11-17
- 0.11.3 — 2020-11-10
- 0.12.0-alpha.1 — 2020-11-02
- 0.12.0-alpha.0 — 2020-10-22
- 0.10.0 — 2020-09-18
- 0.10.0-beta.3 — 2020-09-17
- 0.10.0-beta.2 — 2020-09-16
- 0.10.0-beta.1 — 2020-09-15
- 0.9.0 — 2020-08-25
- … 20 more at https://npm.io/package/@cuillere/postgres/versions

## README

<h1>
  <img src="https://raw.githubusercontent.com/cuillerejs/cuillere/master/logo.png" width="160" />
  <br />
  Welcome to CuillereJS 🥄
</h1>

[![Version](https://img.shields.io/npm/v/@cuillere/core.svg)](https://www.npmjs.com/package/@cuillere/core)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache2.0-yellow.svg)](https://spdx.org/licenses/Apache-2.0.html)

**CuillereJS is an extensible asynchronous execution framework based on generator functions.**

*🚧 CuillereJS is still experimental, APIs may change at any time.*

## Why ?

The goal of CuillereJS is to abstract some inevitable technical complexity (such as managing database transactions) in plugins, and keep business code as simple and focused as possible.

## Usage

In this example we use CuillereJS to manage the connection to a PostgreSQL database.

```js
const cuillere = require('@cuillere/core')
const { poolPlugin, transactionPlugin, queryPlugin } = require('@cuillere/postgres')

const cllr = cuillere(
  poolPlugin({ /* postgres config */ }), // Manages connection pool
  transactionPlugin(), // Manages transactions
  queryPlugin() // Executes queries
)

const addUserAddress = (userId, address, setDefault) => cllr.call(function*() {
  const res = yield query({
    text: `INSERT INTO addresses (userId, street, postalcode, city)
           VALUES ($1, $2, $3, $4)
           RETURNING *`,
    values: [userId, address.street, address.postalCode, address.city]
  })
  if (setDefault) {
    const addressId = res.rows[0].id
    yield query({
      text: `UPDATE users
             SET defaultaddressid = $1
             WHERE userid = $2`,
      values: [addressId, userId]
    })
  }
})
```

## Install

```sh
yarn add @cuillere/core
```

## Authors

👤 **Valentin Cocaud**

* Twitter: [@ragorn44](https://twitter.com/ragorn44)
* Github: [@EmrysMyrddin](https://github.com/EmrysMyrddin)

👤 **Nicolas Lepage**

* Twitter: [@njblepage](https://twitter.com/njblepage)
* Github: [@nlepage](https://github.com/nlepage)

## 🤝 Contributing

Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/cuillerejs/cuillere/issues).

## Show your support

Give a ⭐️ if this project helped you!

## 📝 License

Copyright © 2020 [CuillereJS](https://github.com/cuillerejs).<br />
This project is [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) licensed.

***
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

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