19 lines
405 B
JavaScript
19 lines
405 B
JavaScript
|
|
import mysql from "mysql2";
|
||
|
|
import config from "../config/index.js";
|
||
|
|
|
||
|
|
const pool = mysql.createPool({
|
||
|
|
...config.mysql,
|
||
|
|
queryFormat: function (sql, values) {
|
||
|
|
const opts = { sql, values }
|
||
|
|
this._resolveNamedPlaceholders(opts)
|
||
|
|
return mysql2.format(
|
||
|
|
opts.sql,
|
||
|
|
opts.values,
|
||
|
|
this.config.stringifyObjects,
|
||
|
|
this.config.timezone
|
||
|
|
)
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
export default pool.promise();
|