Skip to content

hollanddd/postgres

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published