I plan to use geddy for a project in the future but I need database transaction handling. I will use PostgreSQL and need a way to open a transaction, perform several SQL queries (insert/update) and close the transaction afterwards. Unfortunately I haven't found any information about transaction handling. Is it possible to work with database transactions using geddy?
Geddy's model layer is handled by the Model project (https://github.com/mde/model). The Postgres adapter exposes an exec method which lets you run arbitrary SQL commands and get the results in a callback. It follows the Node convention of (err, data) for the callback.
You should be able to use this method to run any arbitrary SQL commands you want, including transactions.
Looking at the code, I notice that Geddy doesn't give you direct access to Model's Postgres adapter -- you have to access it by the associated model (e.g., geddy.model.adapters.Foo, if you've set the Foo model to use Postgres). It would be simple to have Geddy expose all the loaded adapters by name on a public property of geddy.model.
Let me know if this gets you unstuck. Definitely not the ideal way to handle transactions, but it should work.
I've created a GH issue for the grabbing a ref to the adapter: mde#317
That sounds great, thank you!
Closing in favor of #317