salix/print/core/database.js

18 lines
371 B
JavaScript
Raw Normal View History

2019-01-22 08:55:35 +00:00
const mysql = require('mysql2/promise');
const config = require('./config.js');
module.exports = {
init() {
if (!this.pool)
this.pool = mysql.createPool(config.mysql);
},
2019-10-24 05:41:54 +00:00
findOne(query, params) {
return this.pool.query(query, params).then(([rows]) => {
return rows[0];
});
},
findFromDef() {
}
2019-01-22 08:55:35 +00:00
};