$ npm i egg-bookshelf --save
// {app_root}/config/plugin.js
exports.bookshelf = {
enable: true,
package: 'egg-bookshelf',
};
egg-knex
support manual/auto commit.
const trx = yield app.knex.transaction();
try {
yield trx.insert(row1).into('table');
yield trx('table').update(row2);
yield trx.commit()
} catch (e) {
yield trx.rollback();
throw e;
}
const result = yield app.knex.transaction(function* transacting (trx) {
yield trx(table).insert(row1);
yield trx(table).update(row2).where(condition);
return { success: true };
});
// {app_root}/config/config.default.js
exports.bookshelf = {
};
see config/config.default.js for more detail.
Please open an issue here.