* Parses the user options into a map of model names and ModelMappingInfo. * @param {MappingOptions} options * @param {String} currentKeyspace * @returns {Map }
(options, currentKeyspace)
| 88 | * @returns {Map<String, ModelMappingInfo>} |
| 89 | */ |
| 90 | static parse(options, currentKeyspace) { |
| 91 | const result = new Map(); |
| 92 | if (!options || !options.models) { |
| 93 | return result; |
| 94 | } |
| 95 | |
| 96 | Object.keys(options.models).forEach(modelName => { |
| 97 | const modelOptions = options.models[modelName]; |
| 98 | result.set(modelName, ModelMappingInfo._create(modelName, currentKeyspace, modelOptions)); |
| 99 | }); |
| 100 | |
| 101 | return result; |
| 102 | } |
| 103 | |
| 104 | static _create(modelName, currentKeyspace, modelOptions) { |
| 105 | if (!currentKeyspace && (!modelOptions || !modelOptions.keyspace)) { |