/data-stub

generate framework relateless data stub from mysql

Primary LanguageJavaScriptMIT LicenseMIT

DATA STUB

NPM version

Build data stub from database for programer

Installation:

yarn add data-stub
npx data-stub -f ls

Configuration:

set config at workdir with name: app.json

{
  "mysql": {
    "host": "127.0.0.1",
    "user": "ketchup",
    "password": "123456",
    "database": "ketchup",
    "port": 3306,
    "charset": "utf8"
  },
  "prefix": "tb"
}

Instructions:

data-stub -f ls list table in the specific database

data-stub -t tableName show result of the tableName

data-stub -f generate -o outputDir generate data stub to outputDir

Target:

// Code generated by data-stub. DO NOT EDIT.
// source: tableName [fileName]

var BaseModel = require('../model')

var model = {
  table: 'tableName',
  fields: {
    'columnName': {
      type: String,
      name: 'columnName',
      comment: 'comment from db',
    }
  }
}
module.exports = new BaseModel(model)

License

MIT