Creates a new wrapper object for constructing a transaction.
Called by the knex.transaction
, which sets the correct client
and handles the container
object, passing along the correct
connection
to keep all of the transactions on the correct connection.
Passed a container
function, this method runs the current
transaction, returning a promise.
The client we need to call finishTransaction
on.
The object passed around inside the transaction container.
"rollback to"?
Ensure the transacting object methods are bound with the correct context.
Initiate a deferred object, so we know when the transaction completes or fails, we know what to do.
Call the container with the transaction commit & rollback objects.
Return the promise for the entire transaction.
Transaction