new TxFactory(dbDriver, ds)
Note: The constructor is not accessible from the client code. Instances are created using DBO factory's createTxFactory() method.
||module:x2node-dbos.DataSource||Connections data source.|
Create and execute a database transaction.
Name Type Description
function Callback function with the transaction logic. The function is passed the transaction as its only argument. The transaction is started by the time the callback is called. The callback may return a
Promise. If the promise is rejected or the callback throws an error, the transaction is automatically rolled back. Otherwise, the transaction is committed.
Returns:The promise of the callback result. If the promise is successfully fulfilled, the transaction is committed. If an error happens and the transaction is rolled back, the promise is rejected with the error.