Waterline.transaction()

Begin a transaction, perform some logic, then either commit the transaction if everything worked, or roll it back if there were any errors.

Usage

Hover over inputs/exits for more info.

var Waterline = require('machinepack-waterline');


// Begin a transaction, perform some logic, then either commit the transaction if everything worked, or roll it back if there were any errors.

Waterline.transaction({

datastore: 'larrysMySQLCluster',

during: '->',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

datastore required

The identity of the datastore to use.

'larrysMySQLCluster'
during required

A function with custom logic to run once a database connection is established and a transaction has begun.

'->'

Exits

error

An unexpected error occurred.

success

OK.

'==='