MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / SIArray_ContainsType

Function SIArray_ContainsType

src/datatypes/array.c:45–58  ·  view source on GitHub ↗

* @brief Returns true if any of the types in 't' are contained in the array or its nested array children, if any * @param siarray: array * @param t: bitmap of types to search for * @retval a boolean indicating whether any types were matched */

Source from the content-addressed store, hash-verified

43 * @retval a boolean indicating whether any types were matched
44 */
45bool SIArray_ContainsType(SIValue siarray, SIType t) {
46 uint array_len = SIArray_Length(siarray);
47 for(uint i = 0; i < array_len; i++) {
48 SIValue elem = siarray.array[i];
49 if(SI_TYPE(elem) & t) return true;
50
51 // recursively check nested arrays
52 if(SI_TYPE(elem) == T_ARRAY) {
53 bool type_is_nested = SIArray_ContainsType(elem, t);
54 if(type_is_nested) return true;
55 }
56 }
57 return false;
58}
59
60/**
61 * @brief Returns true if the array contains an element equals to 'value'

Callers 3

_ValidateAttrTypeFunction · 0.85
ConvertPropertyMapFunction · 0.85
test_arrayFunction · 0.85

Calls 1

SIArray_LengthFunction · 0.85

Tested by 1

test_arrayFunction · 0.68