backend - using engine driver from plugin

This commit is contained in:
Jan Prochazka
2020-11-24 20:42:02 +01:00
parent 424aff5d93
commit c96cb08cfd
9 changed files with 58 additions and 42 deletions

View File

@@ -1,12 +1,10 @@
const driverConnect = require('../utility/driverConnect');
const engines = require('dbgate-engines');
const requireEngineDriver = require("../utility/requireEngineDriver");
async function tableWriter({ connection, schemaName, pureName, ...options }) {
console.log(`Write table ${schemaName}.${pureName}`);
const driver = engines(connection);
const pool = await driverConnect(driver, connection);
const driver = requireEngineDriver(connection);
const pool = await driver.connect(connection);
console.log(`Connected.`);
return await driver.writeTable(pool, { schemaName, pureName }, options);
}