Skip to content

Conversation

sehrope
Copy link
Contributor

@sehrope sehrope commented Dec 10, 2014

pg-db is a module I put together that adds a bunch of things atop node-postgres:

  • Simple interface (ex: db.query(sql, [params], function(err, rows)) or db.queryOne(sql, [params], function(err, row)))
  • Named parameter support (ex: ... WHERE foo = :foo instead of ... WHERE foo = $1)
  • Transactions (more info below)
  • Event hooks (ex: log all SQL that's executed or execute non-transactional hook on commit/rollback)

Transactions are implemented using domains. Database interactions automatically take part in an ongoing transaction so there's no need to manually pass a Client object around. Here's an example: https://github.com/sehrope/node-pg-db-examples/blob/master/src/tx.coffee

@brianc
Copy link
Owner

brianc commented Dec 11, 2014

I dig it! 👍

brianc added a commit that referenced this pull request Dec 11, 2014
Add sehrope/node-pg-db to Extras in README
@brianc brianc merged commit 8d07daf into brianc:master Dec 11, 2014
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

Successfully merging this pull request may close these issues.

2 participants