1.0.5 • Published 6 years ago

mysql-singleton v1.0.5

Weekly downloads
18
License
ISC
Repository
-
Last release
6 years ago

Connecting MySQL database.

example

npm install mysql-singleton --save
const mysql_singleton = require('mysql-singleton');
const config = {
  host: 'localhost',
  user: 'root',
  password: '',
  database: 'database'
}
// adding config
mysql_singleton.config(config)

// getting connection using good old callback 
 mysql_singleton.getConnection(function(err,connection){
        // handle err or connection 
});

// using async await 
const connection = await mysql_singleton.getConnectionPromise();

// writing queries 
 connection.query("select * from table",(err,result)=>{
    // handle result or err             
})

// don't for get to realase the connection after it's use
connection.release(); 
1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago