ys-dbo-mysql

yishu database engine for mysql

Usage no npm install needed!

<script type="module">
  import ysDboMysql from 'https://cdn.skypack.dev/ys-dbo-mysql';
</script>

README

ys-dbo-mysql

ys-dbo的插件之mysql数据处理。

Install

npm i ys-dbo-mysql --save

Usage

const DBO = require('ys-dbo');
const mysql = require('ys-dbo-mysql');
const dbo = new DBO([
  new mysql('mysql', {
    // mysql 配置参数
    pool: true | false, // 是否使用pool
    logger: console
  });
])

注意:我们用way表示线程对像,之后类同

Code

await way.mysql.get();
await way.mysql.begin();
await way.mysql.exec('select * from a where a=?', 1);
await way.mysql.insert(table, data); // data: array or json
await way.mysql.update(table, data, where, wheres);
await way.mysql.delete(table, where, wheres);
await way.mysql.commit();
await way.mysql.rollback();
await way.mysql.release();

License

It is MIT licensed.