mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 06:06:01 +00:00
18 lines
655 B
JavaScript
18 lines
655 B
JavaScript
const { fullNameToString } = require('dbgate-tools');
|
|
const requireEngineDriver = require('../utility/requireEngineDriver');
|
|
const connectUtility = require('../utility/connectUtility');
|
|
|
|
async function tableWriter({ connection, schemaName, pureName, driver, systemConnection, ...options }) {
|
|
console.log(`Writing table ${fullNameToString({ schemaName, pureName })}`);
|
|
|
|
if (!driver) {
|
|
driver = requireEngineDriver(connection);
|
|
}
|
|
const pool = systemConnection || (await connectUtility(driver, connection));
|
|
|
|
console.log(`Connected.`);
|
|
return await driver.writeTable(pool, { schemaName, pureName }, options);
|
|
}
|
|
|
|
module.exports = tableWriter;
|