Transactions
In this schedule, I demonstrate working with transactionality
Example of Using Transactions
try {
await databaseManager.transaction(async (trx) => {
const users = await trx.queryBuilder()
.select()
.from('users')
.execute();
const tasks = await trx.queryBuilder()
.select()
.from('tasks')
.execute();
console.log("Users:", users);
console.log("Tasks:", tasks);
});
console.log('Transaction completed successfully.');
} catch (error) {
console.error('Transaction failed:', error);
}Last updated