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

Function keysAreIncluded

lib/mapping/object-selector.js:300–313  ·  view source on GitHub ↗

* Returns the amount of matches for a given key * @private * @param {Array} keys * @param {Array} propertiesInfo

(keys, propertiesInfo)

Source from the content-addressed store, hash-verified

298 * @param {Array} propertiesInfo
299 */
300function keysAreIncluded(keys, propertiesInfo) {
301 if (keys.length === 0) {
302 return keyMatches.all;
303 }
304
305 // Filtering by name might look slow / ineffective to using hash maps
306 // but we expect `keys` and `propertiesInfo` to contain only few items
307 const matches = propertiesInfo.reduce((acc, p) => acc + (contains(keys, k => p.columnName === k.name) ? 1 : 0), 0);
308 if (matches === 0) {
309 return keyMatches.none;
310 }
311
312 return matches === keys.length ? keyMatches.all : keyMatches.some;
313}
314
315function hasStaticColumn(table) {
316 return staticColumnCount(table) > 0;

Callers 3

getForSelectMethod · 0.85
getForInsertMethod · 0.85
getForUpdateMethod · 0.85

Calls 1

containsFunction · 0.85

Tested by

no test coverage detected