Typescript wrapper around node-postgres
npm install pg-ts```
yarn add pg-ts
Using promises:
`ts
import getPool, { SQL } from "pg-ts";
const pool = getPool();
const { firstName, lastName } = person;
pool.transaction(tx =>
Promise
.all([
tx.none(SQLINSERT INTO people (first_name, last_name) VALUES (${firstName}, ${lastName}))),SELECT * FROM people WHERE first_name = ${firstName})
tx.one(SQL),`
])
.then(([,person]) => person));
Using fp-ts Tasks:
`ts
import getPool, { SQL } from "pg-ts";
const pool = getPool();
pool.oneTask(SQLSELECT * FROM people WHERE first_name = ${firstName})).run();``