Postgresql is a database adapter built on top of the
pg library that provides:
- Running SQL queries and returning rows.
- Transaction management with
BEGIN,COMMIT,ROLLBACK. - Insert operations for one or more rows.
- Update operations with dynamic SQL.
- Checking table existence.
- Reading table schema from
information_schema.
// Basic usage
import { Postgresql } from "@ckn-technology/data";
const pgdb = new Postgresql();
pgdb.host = "localhost";
pgdb.database = "mydb";
const rows = await pgdb.query("SELECT id, name FROM users");
console.log(rows[0]);