Comparing version 0.0.8 to 0.0.9
@@ -15,3 +15,3 @@ const mysql = require('mysql'); | ||
super(); | ||
this.connection = mysql.createConnection(config); | ||
this._config = config; | ||
this.connection.config.queryFormat = (query, values) => { | ||
@@ -102,5 +102,7 @@ query = query.replace(/:insert:/g, () => { | ||
connect(reconnectOnError = 0) { | ||
this.connection = mysql.createConnection(this._config); | ||
return new Promise((resolve, reject) => { | ||
this.connection.connect(async (err) => { | ||
if (err) | ||
if (err) { | ||
this.connection.end(); | ||
if (typeof reconnectOnError === "number" && reconnectOnError > 499 && reconnectOnError < 5001) { | ||
@@ -117,2 +119,3 @@ this.emit("reconnect", err); | ||
} | ||
} | ||
return resolve(true); | ||
@@ -119,0 +122,0 @@ }); |
{ | ||
"name": "amysql", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Useless wrapper over mysql", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
12475
266