@z-ivan/mysql-util
v2.0.1
Published
![Node.js CI](https://github.com/CoderIvan/mysql-util/workflows/Node.js%20CI/badge.svg) ![Node.js Package](https://github.com/CoderIvan/mysql-util/workflows/Node.js%20Package/badge.svg)
Downloads
65
Readme
mysql util
Unit Test
How To Use
const { mysql } = require('@z-ivan/mysql-util')
const pool = mysql.createPool({
host: 'localhost',
port: 3306,
user: 'root',
password: 'root',
database: 'test',
})
// SELECT * FROM test
await pool.exec((squel) => squel.select().from('test').where('a = ?', 1))
// SELECT * FROM test WHERE (a = ?) LIMIT 10 OFFSET 10
// SELECT COUNT(*) AS "_count" FROM test WHERE (a = ?)
await pool.page((squel) => squel.select().from('test').where('a = ?', 1).limit(10).offset(10))
pool.end()