22 lines
460 B
JavaScript
22 lines
460 B
JavaScript
const mysql = require('yn-mysql-utils')
|
|
|
|
class DB {
|
|
constructor () {
|
|
this.data = new mysql({
|
|
host : '127.0.0.1',
|
|
user : 'root',
|
|
password : 'lb714500',
|
|
database : 'shop',
|
|
connectionLimit : 10
|
|
});
|
|
}
|
|
|
|
async Query(params) {
|
|
return await this.data.Query({
|
|
sql: params.sql,
|
|
par: params.data
|
|
})
|
|
}
|
|
}
|
|
|
|
module.exports = new DB(); |