GithubHelp home page GithubHelp logo

data-stub's Introduction

DATA STUB

NPM version Build Status codecov

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",
  "data-stub": {
    "exclude": ["tb_name"]
  }
}

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)

## Usage

```shell
Usage: bin.js -t <table> -o <output> -p <print> -f <functionName> -c
<configPath>

选项:
  --version       显示版本号                                              [布尔]
  --table, -t     要生成的数据表                                    [默认值: ""]
  --print, -p     是否打印                                   [默认值: "console"]
  --function, -f  执行的功能[generate, ls, table]              [默认值: "table"]
  --config, -c    配置文件的位置                            [默认值: "app.json"]
  --output, -o    输出目录                                      [默认值: "dist"]
  --language, -l  输出语言
                     [可选值: "javascript", "typescript"] [默认值: "javascript"]
  --help          显示帮助信息                                            [布尔]

License

MIT

data-stub's People

Contributors

liuwill avatar

Watchers

 avatar

Forkers

hzzhujf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.