@pujansrt/data-genie
Version:
High performant ETL engine written in TypeScript
18 lines (17 loc) • 862 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../index");
async function runExample() {
let reader = new index_1.CSVReader('input/example.csv').setFieldNamesInFirstRow(true);
reader = new index_1.TransformingReader(reader).add(new index_1.BasicFieldTransformer('Balance', 'CreditLimit').stringToDouble());
const groupByReader = new index_1.GroupByReader(reader, 'Rating')
.count('AccountCount')
.max('Balance', 'MaxBalance')
.min('Balance', 'MinBalance')
.avg('Balance', 'AvgBalance')
.sum('Balance', 'SumBalance')
.avg('CreditLimit', 'AvgCreditLimit');
await index_1.Job.run(groupByReader, new index_1.ConsoleWriter());
// await Job.run(groupByReader, new JsonWriter('output/aggregated-data.json'));
}
runExample().catch(console.error);