const Knex = require('knex');
const dbs = {
one: Knex({
client: 'mysql',
connection: {
host: '127.0.0.1',
user: 'root',
password: 'root',
database: 'mysql',
},
}),
two: Knex({
client: 'mysql',
connection: {
host: '127.0.0.1',
user: 'root',
password: 'root',
database: 'mysql',
},
}),
};
(async () => {
const [[time1]] = await dbs.one.raw('select now() as time');
const [[time2]] = await dbs.two.raw('select now() as time');
console.log(time1['time']);
console.log(time2['time']);
dbs.one.destroy();
dbs.two.destroy();
})();