mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 10:16:00 +00:00
24 lines
600 B
JavaScript
24 lines
600 B
JavaScript
const { createBulkInsertStreamBase } = global.DBGATE_PACKAGES['dbgate-tools'];
|
|
const _ = require('lodash');
|
|
|
|
/**
|
|
*
|
|
* @param {import('dbgate-types').EngineDriver} driver
|
|
*/
|
|
function createOracleBulkInsertStream(driver, stream, dbhan, name, options) {
|
|
const writable = createBulkInsertStreamBase(driver, stream, dbhan, name, options);
|
|
|
|
writable.send = async () => {
|
|
await dbhan.client.insert({
|
|
table: name.pureName,
|
|
values: writable.buffer,
|
|
format: 'JSONEachRow',
|
|
});
|
|
writable.buffer = [];
|
|
};
|
|
|
|
return writable;
|
|
}
|
|
|
|
module.exports = createOracleBulkInsertStream;
|