1.1.1 • Published 3 years ago

websir-mysql v1.1.1

Weekly downloads
10
License
ISC
Repository
github
Last release
3 years ago

websir-mysql 是什么?

用于根据指定的 mysql 数据库接口 生成:

  • JSON
  • typescript-interface (用于语法提示)
  • vscode code-snippets (用于在 js 中快速输入)

安装

npm install webisr-mysql -D

配置

项目根创建 websir.config.js 文件 写入正确的数据库配置

module.exports = {
  mysql: {
    host: "<数据库地址>",
    port: "<端口>",
    user: "<用户名>",
    password: "<密码>",
    database: "<库名>",
    parseTableNameBefore(tableName) {
      //处理表名(默认驼峰 根据 下划线 分割)前的钩子 提供重命名表名机会
      return tableName.split("_").slice(1).join("_");
    },
    arseTableNameAfter(tableName) {
       //处理表名 (默认驼峰 根据 下划线 分割) 后的钩子 提供重命名表名机会
      return tableName;
    },
  }
}

例:

module.exports = {
    mysql: {
        host: "127.0.0.1",
        port: "3306",
        user: "root",
        password: "root",
        database: "qqs"
    }
}

生成

package.json 中

 "scripts": {
    "websir": "websir-mysql"
  }

命令行

npm run websir

使用

生成 html

.vue(html) / .html #表名

.js / .vue(js) @表名

生成 js 属性

1.1.1

3 years ago

1.1.0

3 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago