* Creates a new instance of Mapper. * @param {Client} client The Client instance to use to execute the queries and fetch the metadata. * @param {MappingOptions} [options] The [MappingOptions]module:mapping~MappingOptions containing the * information of the models and table mappings.
(client, options)
| 66 | * information of the models and table mappings. |
| 67 | */ |
| 68 | constructor(client, options) { |
| 69 | if (!client) { |
| 70 | throw new Error('client must be defined'); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * The Client instance used to create this Mapper instance. |
| 75 | * @type {Client} |
| 76 | */ |
| 77 | this.client = client; |
| 78 | |
| 79 | this._modelMappingInfos = ModelMappingInfo.parse(options, client.keyspace); |
| 80 | this._modelMappers = new Map(); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Gets a [ModelMapper]{@link module:mapping~ModelMapper} that is able to map documents of a certain model into |