dot-mysql
v0.0.29
Published
Promisified MySQL Helper
Downloads
5
Readme
Dot-MySQL ·
dot-mysql is a JavaScript library for building mysql queries.
· API · JSDOC ·
Installation
npm install --save dot-mysql
Usage
Import
import MySQL from 'dot-mysql'
Config
import MySQL from 'dot-mysql';
MySQL.config({
host: 'localhost',
port: 3306,
database: 'test',
user: 'root',
password: ''
});
Direct Query
import MySQL from 'dot-mysql';
MySQL
.query({ sql: 'SELECT * FROM table' })
.then(({ results }) => {
console.log(results);
});
Query Builder
import MySQL from 'dot-mysql';
const db = new MySQL();
db
.select('*')
.from('table')
.exec()
.then(({ results }) => {
console.log(results);
});