MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / hashTypeGetValueObject

Function hashTypeGetValueObject

src/t_hash.cpp:137–145  ·  view source on GitHub ↗

Like hashTypeGetValue() but returns a Redis object, which is useful for * interaction with the hash type outside t_hash.c. * The function returns NULL if the field is not found in the hash. Otherwise * a newly allocated string object with the value is returned. */

Source from the content-addressed store, hash-verified

135 * The function returns NULL if the field is not found in the hash. Otherwise
136 * a newly allocated string object with the value is returned. */
137robj *hashTypeGetValueObject(robj_roptr o, sds field) {
138 const unsigned char *vstr;
139 unsigned int vlen;
140 long long vll;
141
142 if (hashTypeGetValue(o,field,&vstr,&vlen,&vll) == C_ERR) return NULL;
143 if (vstr) return createStringObject((char*)vstr,vlen);
144 else return createStringObjectFromLongLong(vll);
145}
146
147/* Higher level function using hashTypeGet*() to return the length of the
148 * object associated with the requested field, or 0 if the field does not

Callers 2

lookupKeyByPatternFunction · 0.85
RM_HashGetFunction · 0.85

Calls 3

hashTypeGetValueFunction · 0.85
createStringObjectFunction · 0.70

Tested by

no test coverage detected