diff --git a/schema.cc b/schema.cc index 360c17eaab..87d40c8bc4 100644 --- a/schema.cc +++ b/schema.cc @@ -75,6 +75,14 @@ column_mapping_entry& column_mapping_entry::operator=(const column_mapping_entry return operator=(std::move(copy)); } +bool operator==(const column_mapping_entry& lhs, const column_mapping_entry& rhs) { + return lhs.name() == rhs.name() && lhs.type() == rhs.type(); +} + +bool operator!=(const column_mapping_entry& lhs, const column_mapping_entry& rhs) { + return !(lhs == rhs); +} + bool operator==(const column_mapping& lhs, const column_mapping& rhs) { const auto& lhs_columns = lhs.columns(), rhs_columns = rhs.columns(); if (lhs_columns.size() != rhs_columns.size()) { @@ -82,7 +90,7 @@ bool operator==(const column_mapping& lhs, const column_mapping& rhs) { } for (size_t i = 0, end = lhs_columns.size(); i < end; ++i) { const column_mapping_entry& lhs_entry = lhs_columns[i], rhs_entry = rhs_columns[i]; - if (lhs_entry.name() != rhs_entry.name() || lhs_entry.type() != rhs_entry.type()) { + if (lhs_entry != rhs_entry) { return false; } } diff --git a/schema.hh b/schema.hh index 616584168e..355f130c69 100644 --- a/schema.hh +++ b/schema.hh @@ -447,6 +447,9 @@ public: bool is_atomic() const { return _is_atomic; } }; +bool operator==(const column_mapping_entry& lhs, const column_mapping_entry& rhs); +bool operator!=(const column_mapping_entry& lhs, const column_mapping_entry& rhs); + // Encapsulates information needed for converting mutations between different schema versions. // // Unsafe to access across shards.