@rusdidev/pg-query-builder
v1.0.9
Published
Query builder for postgres, the result is a string and query parameter
Downloads
188
Readme
PG Query Builder
This repository provides a lightweight query builder library for interacting with PostgreSQL databases in Node.js applications written in TypeScript.
Features
- Type-safe: Leverages TypeScript to ensure strong typing for queries and parameters, preventing errors at compile time.
- Fluent API: Builds queries in a chainable manner, making code concise and readable.
- Supports basic CRUD operations: Offers methods for selecting, inserting, updating, and deleting data.
- Parameterization: Prevents SQL injection vulnerabilities by using parameterized queries.
Usage
import { select } from 'pg-query-builder';
const [query,params] = select({table:"account"}).addSelectItems("id", "name").useLimit(10,2).compile();
Expected query is select id, name from account limit 10 offset 2
You can use query and its params in your Node.js application.