mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 09:36:01 +00:00
22 lines
508 B
JavaScript
22 lines
508 B
JavaScript
const stream = require('stream');
|
|
const { transformRowUsingColumnMap } = require('dbgate-tools');
|
|
|
|
class ColumnMapTransformStream extends stream.Transform {
|
|
constructor(columns) {
|
|
super({ objectMode: true });
|
|
this.columns = columns;
|
|
}
|
|
_transform(chunk, encoding, done) {
|
|
if (chunk.__isStreamHeader) {
|
|
// skip stream header
|
|
done();
|
|
return;
|
|
}
|
|
|
|
this.push(transformRowUsingColumnMap(chunk, this.columns));
|
|
done();
|
|
}
|
|
}
|
|
|
|
module.exports = ColumnMapTransformStream;
|