diff --git a/src/storage/common/types/property_value.cpp b/src/storage/common/types/property_value.cpp index 2c28fc6b9..3cb706047 100644 --- a/src/storage/common/types/property_value.cpp +++ b/src/storage/common/types/property_value.cpp @@ -316,3 +316,25 @@ bool operator==(const PropertyValue &first, const PropertyValue &second) { second.Value>(); } } + +bool operator<(const PropertyValue &first, const PropertyValue &second) { + if (first.type() != second.type()) return first.type() < second.type(); + switch (first.type()) { + case PropertyValue::Type::Null: + return false; + case PropertyValue::Type::Bool: + return first.Value() < second.Value(); + case PropertyValue::Type::Int: + return first.Value() < second.Value(); + case PropertyValue::Type::Double: + return first.Value() < second.Value(); + case PropertyValue::Type::String: + return first.Value() < second.Value(); + case PropertyValue::Type::List: + return first.Value>() < + second.Value>(); + case PropertyValue::Type::Map: + return first.Value>() < + second.Value>(); + } +} diff --git a/src/storage/common/types/property_value.hpp b/src/storage/common/types/property_value.hpp index d34114eae..558eee2d3 100644 --- a/src/storage/common/types/property_value.hpp +++ b/src/storage/common/types/property_value.hpp @@ -128,3 +128,4 @@ std::ostream &operator<<(std::ostream &os, const PropertyValue &value); // comparison bool operator==(const PropertyValue &first, const PropertyValue &second); +bool operator<(const PropertyValue &first, const PropertyValue &second);