In the near future we will have more storage technologies supported:
Cassandra
MongoDB
In the distant future we might further include:
Redis
HBase
Neo4J
...
In spite of these being stored in separate folders we want to be able to include all models with a single require statement:
const models = require('models-helper.js')
Implement the above models-helper.js as laid out by the following pseudo code gist:
let allModels = {}
const modelTypeDirs = [ 'models', 'models-webservice', 'models-cassandra', ... ]
// Even better: Use a glob expression to get all folders that have "models" in their name
// const modelTypeDirs = Dir.glob( "*model*")
for ( modelDir in modelTypeDirs ) {
let modelDirRequired = require( modelDir )
// Validate:
// Throw an error if modelDirRequired has an entry that is already present in allModels
// That is, check if there are two models that have the same name,
// but are stored in different storage technologies
allModels = Object.assign( allModels, modelDirRequired )
}
Currently we support two types of data models:
SQL
stored inmodels
folderWeb-Service
stored inmodels-webservice
In the near future we will have more storage technologies supported:
Cassandra
MongoDB
In the distant future we might further include:
Redis
HBase
Neo4J
In spite of these being stored in separate folders we want to be able to include all models with a single require statement:
Implement the above
models-helper.js
as laid out by the following pseudo code gist:No test required. A short manual test is enough.
Expected work time: 3h