thinkraz-api-model-auto-router
v2.0.2
Published
使用方法:
Downloads
32
Readme
thinkraz-api-model-auto-router
使用方法:
开一个modelAutoRouter
const modelAutoRouter = require('thinkraz-api-model-auto-router');
const ErrorMap = require('thinkraz').ErrorMap;
const DatabaseErrorReducer = ErrorMap.reducer('database');
let base = modelAutoRouter(null,(err,data)=>{
return DatabaseErrorReducer.reduce(err,data);
},config);
module.exports = base;
即可像原本一样使用
hasOne的格式: routerRelationship[tableName] = { master: {targetDb: modelClass,type:'hasOne'}, column名称: {targetDb: 模型类,type:'hasMany'}, }