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

Already on GitHub? Sign in to your account

Let me pass in a pg.Client #136

Merged
merged 1 commit into from Oct 23, 2012

Conversation

Projects
None yet
2 participants
Contributor

aslakhellesoy commented Oct 23, 2012

This way I can use the same connection from my app instead of creating a 2nd connection. Similar to #30 and #31.

Let me pass in a pg.Client so I can use the same connection from my a…
…pp instead of creating a 2nd connection. Similar to #30 and #31.
Owner

josephg commented Oct 23, 2012

I'd like a test, but this looks pretty failproof... famous last words

josephg added a commit that referenced this pull request Oct 23, 2012

@josephg josephg merged commit 7a953a8 into josephg:master Oct 23, 2012

Contributor

aslakhellesoy commented Oct 23, 2012

Thanks - I started looking at how to test this. It requires modification of bin/options.js, but then since each test closes the connection in teardown it would require some bigger changes. Seems like more trouble than it's worth.

Contributor

aslakhellesoy commented Oct 23, 2012

In pg.coffee:

client = if options.client then (if typeof options.client=='function' then options.client() else options.client) else new pg.Client options.uri

In options.js:

type: 'pg',
client: function(){return new require('pg').native.Client('tcp://josephg:@localhost/postgres')},
create_tables_automatically: true,

Not sure you want a patch for that - it passes though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment