Created
August 17, 2017 16:36
-
-
Save jjhamshaw/514d964d0373eb43aab5ec3a2ed0091b to your computer and use it in GitHub Desktop.
Conceptual idea
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import async from 'async'; | |
export default class ETLRunner { | |
constructor(extractor, transformer, loader) { | |
this.extractor = extractor; | |
this.transformer = transformer; | |
this.loader = loader; | |
} | |
extract(callback) { | |
const data = this.extractor(); | |
callback(null, data); | |
} | |
transform(data, callback) { | |
const transformedData = this.transformer(data); | |
callback(null, transformedData); | |
} | |
load(data, callback) { | |
this.loader(data); | |
callback(null, 'done'); | |
} | |
run() { | |
async.waterfall([ | |
this.extract, | |
this.transform, | |
this.load, | |
], (err, result) => { | |
console.log(result); // result equals 'done' | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment