MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / adaptUserHints

Method adaptUserHints

lib/metadata/index.js:847–871  ·  view source on GitHub ↗

* Uses the metadata to fill the user provided parameter hints * @param {String} keyspace * @param {Array} hints * @internal * @ignore

(keyspace, hints)

Source from the content-addressed store, hash-verified

845 * @ignore
846 */
847 async adaptUserHints(keyspace, hints) {
848 if (!Array.isArray(hints)) {
849 return;
850 }
851 const udts = [];
852 // Check for udts and get the metadata
853 for (let i = 0; i < hints.length; i++) {
854 const hint = hints[i];
855 if (typeof hint !== 'string') {
856 continue;
857 }
858
859 const type = types.dataTypes.getByName(hint);
860 this._checkUdtTypes(udts, type, keyspace);
861 hints[i] = type;
862 }
863
864 for (const type of udts) {
865 const udtInfo = await this.getUdt(type.info.keyspace, type.info.name);
866 if (!udtInfo) {
867 throw new TypeError('User defined type not found: ' + type.info.keyspace + '.' + type.info.name);
868 }
869 type.info = udtInfo;
870 }
871 }
872
873 /**
874 * @param {Array} udts

Callers 1

client.jsFile · 0.80

Calls 2

_checkUdtTypesMethod · 0.95
getUdtMethod · 0.95

Tested by

no test coverage detected