Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "q-postgres", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Postgres with promises.", | ||
@@ -5,0 +5,0 @@ "main": "q-postgres.js", |
'use strict'; | ||
var q = require('q'); | ||
var PgConnection = require('./pg.connection'); | ||
var PostgresClient = require('pg').Client; | ||
var Promise = require('q').Promise; | ||
var Postgres = require('pg'); | ||
var PgWrapper = require('./pg.wrapper'); | ||
@@ -14,17 +14,14 @@ function PgPromise(user, pass, host, base) { | ||
var connString = 'postgres://'.concat(user, ':', pass, '@', host, base); | ||
var connString = 'pg://'.concat(user, ':', pass, '@', host, base); | ||
pgPromise.connect = function() { | ||
return q.Promise(function(resolve, reject) { | ||
var postgresClient = new PostgresClient(connString); | ||
return Promise(function(resolve, reject) { | ||
Postgres.connect(connString, function(err, client, done) { | ||
if (err) { | ||
reject(err); | ||
return done(); | ||
} | ||
postgresClient.connect(function(err) { | ||
if (err) return reject(err); | ||
var pgConnection = new PgConnection(postgresClient); | ||
pgConnection | ||
.openTransaction() | ||
.then(resolve) | ||
.catch(reject); | ||
var pgWrapper = new PgWrapper(client, done); | ||
resolve(pgWrapper); | ||
}); | ||
@@ -31,0 +28,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4598
60