1.0.0 • Published 10 months ago

lit-postgres v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Postgres

A PostgreSQL utility library aimed as serverless compute on AWS RDS.

Install

npm install lit-postgres --save

SQL tagged template

sql

Construct SQL queries using a tagged template. The function translates queries into a native Postgres parameterized query to help prevent SQL injections.

The function automatically creates a pooled database connection and connects to the databse specified by standard pg environment variables.

const greeting = "Hello, world!";
const { rows, rowCount } =
    await sql`select ${greeting}::text as "message"`;

Inspiration

Inspired by @vercel/postgres and the proliferaion of .sql files in Node.js applications which introduces blocking io to read and is rarely cached.

1.0.0

10 months ago

0.0.4

10 months ago