爱用装饰器风格查询MySQL的框架一枚鸭~


Keywords
decorator-mysql, decorator, mysql, xuanxiaoqian
License
MIT
Install
npm install decorator-mysql@1.0.21

Documentation

decorator-mysql

爱用装饰器风格查询MySQL的框架一枚鸭~


文档:文档网站

安装

npm i decorator-mysql

快速开始

  1. 初始化数据源

    import { initMysql } from "decorator-mysql";
    
    const pool = initMysql({
        host: 'localhost',
        user: 'root',
        password: '123456',
        database: 'decorator_mysql',
        port: 3306,
        connectionLimit: 10,
    });
  2. 查询装饰器

    import { Select, SelectResults } from 'decorator-mysql'
    
    @Select('select * from user')
    selectUserById: () => SelectResults<any>
  3. 使用

    await new xxx().selectUserById()

趣味对比

疑问交流

暂无