Neutral Political Machine
Introducing npm Teams! Private packages + team management tools.Learn more »

@xibang/mysql

1.0.1 • Public • Published

Xibang MySQL

github npm npm codecov codebeat badge Build Status

安装

yarn add @xibang/mysql

ES7 使用

POOL

const { pool } = require('@xibang/mysql');
 
(async(){
  // 传入配置,新建一个Pool,如果已有Pool则直接拿来使用
  const cn = await pool({
    host: '127.0.0.1',
    user: 'root',
    password: 'root',
    database: 'test'
  }); // 根据当前数据库配置创建一个连接
  console.log(await cn.query('SELECT 1'));
})();

CONNECTION

const { connection } = require('@xibang/mysql');
 
(async(){
  // 传入配置,新建一个连接,,如果已有连接则直接拿来使用
  const cn = await connection({
    host: '127.0.0.1',
    user: 'root',
    password: 'root',
    database: 'test'
  });
  console.log(await cn.query('SELECT 1'));
})();

FORMAT

const { pool, format } = require('@xibang/mysql');
 
(async(){
  const cn = await pool({
    host: '127.0.0.1',
    user: 'root',
    password: 'root',
    database: 'test'
  });
  console.log(await cn.query(format('SELECT 1')));
})();

License

Apache 2.0

通过支付宝捐赠:

qr

Install

npm i @xibang/mysql

DownloadsWeekly Downloads

1

Version

1.0.1

License

Apache-2.0

Unpacked Size

18.4 kB

Total Files

15

Last publish

Collaborators

  • avatar