mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
initial work on streamlined client interface
This commit is contained in:
parent
9ba0f9ed17
commit
f8096cbe55
21
lib/index.js
21
lib/index.js
@ -2,7 +2,22 @@ var EventEmitter = require('events').EventEmitter;
|
||||
var sys = require('sys');
|
||||
var net = require('net');
|
||||
|
||||
module.exports = {
|
||||
Client: require(__dirname+'/client'),
|
||||
Connection: require(__dirname + '/connection')
|
||||
var Client = require(__dirname+'/client');
|
||||
|
||||
var connect = function(config, callback) {
|
||||
var client = new Client(config);
|
||||
client.connect();
|
||||
var onError = function() {
|
||||
|
||||
};
|
||||
client.once('error', onError);
|
||||
client.connection.once('readyForQuery', function() {
|
||||
callback
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
Client: Client
|
||||
Connection: require(__dirname + '/connection'),
|
||||
connect: connect
|
||||
};
|
||||
|
||||
9
test/integration/client/api-tests.js
Normal file
9
test/integration/client/api-tests.js
Normal file
@ -0,0 +1,9 @@
|
||||
var helper = require(__dirname + '/../test-helper');
|
||||
var pg = require(__dirname + '/../../../lib');
|
||||
|
||||
var connected = false;
|
||||
pg.connect(helper.args, function(err) {
|
||||
connected = true;
|
||||
});
|
||||
|
||||
assert.ok(connected);
|
||||
Loading…
x
Reference in New Issue
Block a user