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

Function getObjectTypeName

src/db.cpp:1427–1447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1425}
1426
1427const char* getObjectTypeName(robj_roptr o) {
1428 const char* type;
1429 if (o == nullptr) {
1430 type = "none";
1431 } else {
1432 switch(o->type) {
1433 case OBJ_STRING: type = "string"; break;
1434 case OBJ_LIST: type = "list"; break;
1435 case OBJ_SET: type = "set"; break;
1436 case OBJ_ZSET: type = "zset"; break;
1437 case OBJ_HASH: type = "hash"; break;
1438 case OBJ_STREAM: type = "stream"; break;
1439 case OBJ_MODULE: {
1440 moduleValue *mv = (moduleValue*)ptrFromObj(o);
1441 type = mv->type->name;
1442 }; break;
1443 default: type = "unknown"; break;
1444 }
1445 }
1446 return type;
1447}
1448
1449void typeCommand(client *c) {
1450 robj_roptr o = lookupKeyReadWithFlags(c->db,c->argv[1],LOOKUP_NOTOUCH);

Callers 3

scanFilterAndReplyFunction · 0.85
typeCommandFunction · 0.85
snapshot_scan_callbackFunction · 0.85

Calls 1

ptrFromObjFunction · 0.85

Tested by

no test coverage detected