MCPcopy Create free account
hub / github.com/apple/foundationdb / tupleToString

Function tupleToString

bindings/flow/tester/Tester.actor.cpp:91–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91std::string tupleToString(Tuple const& tuple) {
92 std::string str = "(";
93 for (int i = 0; i < tuple.size(); ++i) {
94 Tuple::ElementType type = tuple.getType(i);
95 if (type == Tuple::NULL_TYPE) {
96 str += "NULL";
97 } else if (type == Tuple::BYTES || type == Tuple::UTF8) {
98 if (type == Tuple::UTF8) {
99 str += "u";
100 }
101 str += "\'" + tuple.getString(i).printable() + "\'";
102 } else if (type == Tuple::INT) {
103 str += format("%ld", tuple.getInt(i));
104 } else if (type == Tuple::FLOAT) {
105 str += format("%f", tuple.getFloat(i));
106 } else if (type == Tuple::DOUBLE) {
107 str += format("%f", tuple.getDouble(i));
108 } else if (type == Tuple::BOOL) {
109 str += tuple.getBool(i) ? "true" : "false";
110 } else if (type == Tuple::UUID) {
111 Uuid u = tuple.getUuid(i);
112 str += format("%016llx%016llx", *(uint64_t*)u.getData().begin(), *(uint64_t*)(u.getData().begin() + 8));
113 } else if (type == Tuple::NESTED) {
114 str += tupleToString(tuple.getNested(i));
115 } else if (type == Tuple::VERSIONSTAMP) {
116 Versionstamp versionstamp = tuple.getVersionstamp(i);
117 str += format("Transaction Version: '%ld', BatchNumber: '%hd', UserVersion : '%hd'",
118 versionstamp.getVersion(),
119 versionstamp.getBatchNumber(),
120 versionstamp.getUserVersion());
121 } else {
122 ASSERT(false);
123 }
124
125 if (i < tuple.size() - 1) {
126 str += ", ";
127 }
128 }
129
130 str += ")";
131 return str;
132}
133
134ACTOR Future<Standalone<RangeResultRef>> getRange(Reference<Transaction> tr,
135 KeySelectorRef begin,

Callers 3

callMethod · 0.70
callMethod · 0.70

Calls 15

getUuidMethod · 0.80
getBatchNumberMethod · 0.80
getVersionstampMethod · 0.65
formatFunction · 0.50
sizeMethod · 0.45
getTypeMethod · 0.45
printableMethod · 0.45
getStringMethod · 0.45
getIntMethod · 0.45
getFloatMethod · 0.45
getDoubleMethod · 0.45
getBoolMethod · 0.45

Tested by

no test coverage detected