Commit/rollback a knex transaction using async/await
<p>I'm test driving the <a href="https://tc39.github.io/ecmascript-asyncawait/" rel="noreferrer">ES7 async/await proposal</a> using <a href="https://github.com/yortus/asyncawait" rel="noreferrer">this module</a> to emulate it. I'm trying to make <a href="http://knexjs.org/" rel="noreferrer">knex.js</a> transactions play well with them, as a starting point.</p>

<p>Example code:</p>

<pre><code>async function transaction() {
  return new Promise(function(resolve, reject){
    knex.transaction(function(err, result){
      if (err) {
        reject(err);
      } else {
        resolve(result);
      }
    });
  });
}

// Start transaction from this call

insert: async (function(db, data) {
 const trx = await(transaction());
 const idUser = await(user.insertData(trx, data));

 return {
    idCidUserstomer: idUser
  }
})
</code></pre>

<p>How can I <code>commit()</code> or <code>rollback()</code> if a transaction succeeds or fails?</p>