SQLEasy.js/postgresql.js
2023-05-31 13:58:21 +03:00

16 lines
558 B
JavaScript

/* PostreSQL */
const pgsync = require('pg-sync');
class PostgreSQL_Database {
constructor (host, port, database, clientOptions={}) {
this.client = new pgsync.Client(clientOptions);
client.connect(`host=${host} port=${port} dbname=${database}`);
this.client.begin();
this.client.setIsolationLevelSerializable();
// this.client.query(queryText, [params]); -> execute command with SELECT *
// (this.client.prepare(queryText)).execute([params]); -> execute command without SELECT *
}
}