From ebb37b9c9346eb85cfb52a9f66cb2b99bbeeebc0 Mon Sep 17 00:00:00 2001 From: Nikiroy78 <35032449+Nikiroy78@users.noreply.github.com> Date: Wed, 31 May 2023 13:58:21 +0300 Subject: [PATCH] =?UTF-8?q?Add=20PostgresSQL=20support=20(=E2=9A=A0?= =?UTF-8?q?=EF=B8=8FDevelopment)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- postgresql.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 postgresql.js diff --git a/postgresql.js b/postgresql.js new file mode 100644 index 0000000..95ad820 --- /dev/null +++ b/postgresql.js @@ -0,0 +1,15 @@ +/* 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 * + } +}