Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct example for new version of node-postgres #4

Open
tcrimi opened this issue Apr 17, 2013 · 4 comments
Open

Correct example for new version of node-postgres #4

tcrimi opened this issue Apr 17, 2013 · 4 comments

Comments

@tcrimi
Copy link

tcrimi commented Apr 17, 2013

As of version 1.0 of node-postgres, the pg.connect callback now returns a 'done' callback which one needs to use to return the client object to the connection pool.

var pg = require('pg');

function pgConnect (callback) {
    pg.connect('tcp://nodepg:password@localhost/pgstore',
        function (err, client, done) {
            if (err) {
                console.log(JSON.stringify(err));
            }
            if (client) {
                callback(client);
                done();
            }
        }
    );
};
@jebas
Copy link
Owner

jebas commented May 7, 2013

Give me a little time to look at the code. Personal life interfering with productive coding.

@postsql
Copy link

postsql commented Jan 19, 2014

Any progress on this ?

@abhishekmunie
Copy link

#5

@jansc
Copy link

jansc commented Jun 11, 2014

+1
The above code works, the example in Readme.md not. Readme.md should be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants