jebas / connect-pg

PostgreSQL session store for Connect
MIT License
29 stars 9 forks source link

Correct example for new version of node-postgres #4

Open tcrimi opened 11 years ago

tcrimi commented 11 years ago

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 commented 11 years ago

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

postsql commented 10 years ago

Any progress on this ?

abhishekmunie commented 10 years ago

https://github.com/jebas/connect-pg/pull/5

jansc commented 10 years ago

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