{"repo":"sluukkonen/possu","free":true,"listed":false,"github":"https://github.com/sluukkonen/possu","clone":"git clone https://github.com/sluukkonen/possu.git","description":"🐖 A small companion library for node-postgres","language":"TypeScript","stars":21,"topics":["javascript","typescript","postgresql","transaction-handling","tagged-template-literals","node-postgres"],"license":"MIT","category":"databases-storage","readme_excerpt":"Possu 🐖 A small companion library for node-postgres. Features & Goals - A Promise-based API, which aims to reduce boilerplate code - Write raw SQL queries with tagged template strings - Prevent most types of accidental SQL injection vulnerabilities - Transaction and savepoint handling, including retrying in case of serialization failures and deadlocks. - First-class TypeScript support - Not a framework. Most Possu functions take either a pg.Pool or a pg.PoolClient as an argument, so you can integrate Possu easily to an existing application. Table of Contents - Installation - Getting started - API - Building queries - sql - sql.identifier - sql.json - Executing queries - query - queryOne - queryMaybeOne - execute - executeOne - executeMaybeOne - Transaction handling - withTransaction - withSavepoint Installation Run either or depending on your favourite package manager. Getting started If you've ever written an application using node-postgres, a lot of your database code might look a bit like this: In addition to the SQL query, there is some boilerplate code that selects the correct amount of rows from the query result. In a large application, this can get quite repetetive. Things can even more complicated if you're only interested in a single column from the result set. The goal of Possu is to eliminate this kind of boilerplate code from your application. Here we use Possu's sql tagged template literal for constructing the queries, while query and queryMaybeOne functions con","default_branch":null,"files":null,"tree":[],"storefront":"/r/sluukkonen","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sluukkonen/possu/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}