egg-sequelize-autotrx
Advanced tools
Comparing version 0.0.22 to 0.0.23
@@ -39,6 +39,6 @@ module.exports = (options, app) => async (ctx, next) => { | ||
if (transaction) { | ||
app.loggers.coreLogger.info(`[egg-sequelize-autotrx] ctx.[${delegate}].transaction specified transaction`) | ||
app.loggers.coreLogger.info(`[egg-sequelize-autotrx] ctx.${delegate}.transaction specified transaction`) | ||
return oldTrx.call(model, { transaction }, task) | ||
} else { | ||
app.loggers.coreLogger.info(`[egg-sequelize-autotrx] ctx.[${delegate}].transaction no specified transaction`) | ||
app.loggers.coreLogger.info(`[egg-sequelize-autotrx] ctx.${delegate}.transaction no specified transaction`) | ||
return oldTrx.call(model, task) | ||
@@ -49,3 +49,3 @@ } | ||
// will call original transaction function directly, without inject transaction in cls | ||
app.loggers.coreLogger.info(`[egg-sequelize-autotrx] ctx.[${delegate}].transaction call original method`) | ||
app.loggers.coreLogger.info(`[egg-sequelize-autotrx] ctx.${delegate}.transaction call original method`) | ||
return oldTrx.call(model, ...args) | ||
@@ -55,4 +55,4 @@ } | ||
model.transaction.__injected = true | ||
app.loggers.coreLogger.info(`[egg-sequelize-autotrx] ctx.[${delegate}].transaction is injected`) | ||
app.loggers.coreLogger.info(`[egg-sequelize-autotrx] ctx.${delegate}.transaction is injected`) | ||
} | ||
} |
{ | ||
"name": "egg-sequelize-autotrx", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"description": "Auto transaction based on cls-hooked for egg-sequelize plugin", | ||
@@ -5,0 +5,0 @@ "eggPlugin": { |
@@ -168,2 +168,12 @@ # egg-sequelize-autotrx | ||
If you need your nested transaction commit by itself, you can do: | ||
```js | ||
async innerTrx () { | ||
await this.ctx.model.transaction({ transaction: null }, async () => { | ||
// specify the transaction as null, so it will not populated from parent transaction from cls | ||
}) | ||
} | ||
``` | ||
## Questions & Suggestions | ||
@@ -170,0 +180,0 @@ |
12569
185