0.13.1 ā€¢ Published 2 years ago

@cuillere/postgres v0.13.1

Weekly downloads
137
License
Apache-2.0
Repository
github
Last release
2 years ago

cuillere is an asynchronous execution framework based on generator functions and middlewares.

šŸš§ cuillere is still in early development stage, the API may change at any time.

Why ?

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

Usage

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

const cuillere = require('@cuillere/core')
const { poolMiddleware, transactionMiddleware, queryMiddleware } = require('@cuillere/postgres')

const cllr = cuillere(
  poolMiddleware({ /* postgres config */ }), // Manages connection pool
  transactionMiddleware(), // Manages transactions
  queryMiddleware() // Executes queries
)

const addUserAddress = (userId, address, setDefault) => cllr.execute(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

yarn add @cuillere/core

Authors

šŸ‘¤ Valentin Cocaud

šŸ‘¤ Nicolas Lepage

šŸ¤ Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

Show your support

Give a ā­ļø if this project helped you!

šŸ“ License

Copyright Ā© 2019 Valentin Cocaud. This project is Apache-2.0 licensed.


This README was generated with ā¤ļø by readme-md-generator

0.13.1

2 years ago

0.14.0-alpha.0

2 years ago

0.13.0

3 years ago

0.13.0-alpha.2

3 years ago

0.12.0

3 years ago

0.12.0-alpha.4

3 years ago

0.12.0-alpha.3

3 years ago

0.11.3

4 years ago

0.12.0-alpha.1

4 years ago

0.12.0-alpha.0

4 years ago

0.10.0

4 years ago

0.10.0-beta.3

4 years ago

0.10.0-beta.2

4 years ago

0.10.0-beta.1

4 years ago

0.9.0

4 years ago

0.8.0

4 years ago

0.7.6

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago