Support config-driven output formatting
This commit is contained in:
@@ -13,12 +13,14 @@
|
||||
const influxdbFormatter = require('./influxdbFormatter');
|
||||
const jsonFormatter = require('./jsonFormatter');
|
||||
const csvFormatter = require('./csvFormatter');
|
||||
const processFormatter = require('./processFormatter');
|
||||
|
||||
// Built-in registry
|
||||
const registry = {
|
||||
influxdb: influxdbFormatter,
|
||||
json: jsonFormatter,
|
||||
csv: csvFormatter,
|
||||
process: processFormatter,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
9
src/helper/formatters/processFormatter.js
Normal file
9
src/helper/formatters/processFormatter.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Process formatter
|
||||
* Keeps the existing process-port behaviour: emit only changed fields as an object.
|
||||
*/
|
||||
function format(_measurement, metadata) {
|
||||
return metadata.fields;
|
||||
}
|
||||
|
||||
module.exports = { format };
|
||||
Reference in New Issue
Block a user