diff --git a/alternator/executor.cc b/alternator/executor.cc index 7a95a4efa0..2fa795ec8c 100644 --- a/alternator/executor.cc +++ b/alternator/executor.cc @@ -958,21 +958,6 @@ static std::string get_item_type_string(const rjson::value& v) { return it->name.GetString(); } -// Check if a given JSON object encodes a set (i.e., it is a {"SS": [...]}, or "NS", "BS" -// and returns set's type and a pointer to that set. If the object does not encode a set, -// returned value is {"", nullptr} -static const std::pair unwrap_set(const rjson::value& v) { - if (!v.IsObject() || v.MemberCount() != 1) { - return {"", nullptr}; - } - auto it = v.MemberBegin(); - const std::string it_key = it->name.GetString(); - if (it_key != "SS" && it_key != "BS" && it_key != "NS") { - return {"", nullptr}; - } - return std::make_pair(it_key, &(it->value)); -} - // Take two JSON-encoded list values (remember that a list value is // {"L": [...the actual list]}) and return the concatenation, again as // a list value. diff --git a/alternator/serialization.cc b/alternator/serialization.cc index 4441b6a502..2c6769288d 100644 --- a/alternator/serialization.cc +++ b/alternator/serialization.cc @@ -246,4 +246,16 @@ big_decimal unwrap_number(const rjson::value& v, std::string_view diagnostic) { return big_decimal(it->value.GetString()); } +const std::pair unwrap_set(const rjson::value& v) { + if (!v.IsObject() || v.MemberCount() != 1) { + return {"", nullptr}; + } + auto it = v.MemberBegin(); + const std::string it_key = it->name.GetString(); + if (it_key != "SS" && it_key != "BS" && it_key != "NS") { + return {"", nullptr}; + } + return std::make_pair(it_key, &(it->value)); +} + } diff --git a/alternator/serialization.hh b/alternator/serialization.hh index 50a550b2e3..95cc15732c 100644 --- a/alternator/serialization.hh +++ b/alternator/serialization.hh @@ -63,4 +63,10 @@ clustering_key ck_from_json(const rjson::value& item, schema_ptr schema); // If v encodes a number (i.e., it is a {"N": [...]}, returns an object representing it. Otherwise, // raises ValidationException with diagnostic. big_decimal unwrap_number(const rjson::value& v, std::string_view diagnostic); + +// Check if a given JSON object encodes a set (i.e., it is a {"SS": [...]}, or "NS", "BS" +// and returns set's type and a pointer to that set. If the object does not encode a set, +// returned value is {"", nullptr} +const std::pair unwrap_set(const rjson::value& v); + }