Closed Napas closed 5 years ago
The hooks are passed the same database handle as you pass in to the method itself. https://github.com/volatiletech/sqlboiler/blob/master/templates/15_insert.go.tpl#L44-L46
So if you pass in a transaction to the Insert
then that same transaction is used for the hooks as well.
Hi,
I need to execute a couple more inserts/updates in the hook beforeInsert or afterInsert hook.
Is there a way to wrap everything in the single transaction, so if any of the queries (including model insert query) fails - all other will be reverted?