ys-dbo
YS 架构之请求线程的引擎管理类,用于完善处理请求自定义逻辑,支持自定义回滚机制。
Install
npm i ys-dbo --save
Usage
const DBO = ;const dbo = // plugins ...
目前插件支持以下2个:
其他插件用户可以根据DBO提供的生命周期自行开发。
dbo.until(next, options)
用于处理一个线程的逻辑
- next
function
逻辑处理函数 - options
json
参数配置- context
object
dbo将会在这个对象上添加一个命名空间对象 - name
string
命名空间名称 - error
function
错误处理函数error(err, ctx) {}
- err
error
错误 - ctx 同上的
context
- err
- context
const target = {};dbo
Use in koa2 middleware
app;
Use events
app; app; { return async { await { ; } }}
License
It is MIT licensed.