packages/rear-sql/query.js
function exec(sqlQuery, poolName) {
  return new Promise((resolve, reject) => {
    db.connect((err, client, done) => {
      if (err) {
        reject(err);
      }
      client.query(sqlQuery, (err, results) => {
        if (err) {
          reject(err);
        }
        resolve(results);
      });
    }, poolName || 'default', );
  });
}
function exec(sqlQuery, poolName) {
  return new Promise((resolve, reject) => {
    db.connect((err, client, done) => {
      if (err) {
        reject(err);
      }
      client.query(sqlQuery, (err, results) => {
        if (err) {
          reject(err);
        }
        resolve(results);
      });
    }, poolName || 'default', );
  });
}
function exec ( sqlQuery , poolName ) { return new Promise ( ( resolve , reject ) => { db . connect ( ( err , client , done ) => { if ( err ) { reject ( err ) ; } client . query ( sqlQuery , ( err , results ) => { if ( err ) { reject ( err ) ; } resolve ( results ) ; } ) ; } , poolName || 'default' , ) ; } ) ; }
Execute a sql query with pg.Pool

@param  {ParametizedQuery} sqlQuery Parametized pg query object
@return {Promise<Object>}           Resolve with query results

@example

const query = require('./query')
const SQL = query.SQL

const id = 2

query.exec(SQL`SELECT * FROM "Users" WHERE id = ${id}`)
.then((result) => {
console.log('User', result.rows[0])
})
Execute a sql query with pg . Pool