Skip to content

Commit 313c41a

Browse files
committed
Cleanup
1 parent 94a628a commit 313c41a

File tree

3 files changed

+198
-198
lines changed

3 files changed

+198
-198
lines changed

lib/client.js

+10-14
Original file line numberDiff line numberDiff line change
@@ -354,29 +354,25 @@ Client.prototype._pulseQueryQueue = function () {
354354
}
355355
};
356356

357-
Client.prototype.copyFrom = function (text) {
358-
throw new Error("For PostgreSQL COPY TO/COPY FROM support npm install pg-copy-streams");
359-
};
360-
361-
Client.prototype.copyTo = function (text) {
362-
throw new Error("For PostgreSQL COPY TO/COPY FROM support npm install pg-copy-streams");
363-
};
364-
365-
const DeprecatedQuery = require('./utils').deprecateEventEmitter(Query)
366-
367357
Client.prototype.query = function (config, values, callback) {
368358
//can take in strings, config object or query object
369359
var query;
370360
var result;
371361
if (typeof config.submit == 'function') {
372-
query = config
373-
result = query
362+
result = query = config
374363
if (typeof values == 'function') {
375364
query.callback = query.callback || values
376365
}
377366
} else {
378-
query = new DeprecatedQuery(config, values, callback)
379-
result = query
367+
query = new Query(config, values, callback)
368+
if (!query.callback) {
369+
let resolve, reject;
370+
result = new Promise((res, rej) => {
371+
resolve = res
372+
reject = rej
373+
})
374+
query.callback = (err, res) => err ? reject(err) : resolve(res)
375+
}
380376
}
381377

382378
if (this.binary && !query.binary) {

0 commit comments

Comments
 (0)