aboutsummaryrefslogtreecommitdiff
path: root/query-executor.js
blob: 58189b579674f5c5a1edaf1ec67eaefccea38803 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"use strict";

const { ipcRenderer } = require("electron");
const { Pool } = require("pg");

const connectionPool = new Pool({
  user: "postgres",
  host: "localhost",
  database: "postgres",
  password: "",
  port: 5432
});

ipcRenderer.on("queryExecutor.runQuery", (event, payload) => {

  connectionPool.query(payload, (err, res) => {

    console.log(err, res)

    ipcRenderer.send("queryExecutor.runQueryComplete", {
      "error": err,
      "result": res
    });

  });

});