thinkraz-api-model-auto-router

    2.0.2 • Public • Published

    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'}, }

    Keywords

    none

    Install

    npm i thinkraz-api-model-auto-router

    DownloadsWeekly Downloads

    16

    Version

    2.0.2

    License

    ISC

    Unpacked Size

    134 kB

    Total Files

    15

    Last publish

    Collaborators

    • goodman3
    • myq1991