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()