Last active
July 7, 2017 08:46
-
-
Save bastienmichaux/3832193a44f00338a9f261cfae7b5d2c to your computer and use it in GitHub Desktop.
db-importer refactoring sketch
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
//mysql.js | |
const getConnection = () => foo(); | |
const importTables = () => bar(); | |
const getConstraints = () => xyz(); | |
module.exports = {getConnection, importTables, getConstraints}; | |
//sqlite.js : idem | |
const getConnection = () => fizz(); | |
const importTables = () => qux(); | |
const getConstraints = () => arg(); | |
module.exports = {getConnection, importTables, getConstraints}; | |
//etc... | |
//index.js | |
const dbms = () => somethingSomething; // return the appropriate module | |
const connection = dbms().getConnection(); | |
const tables = dbms().importTables(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment