diff options
Diffstat (limited to 'controller/DB.hpp')
-rw-r--r-- | controller/DB.hpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/controller/DB.hpp b/controller/DB.hpp index efb08d63..aebe4e11 100644 --- a/controller/DB.hpp +++ b/controller/DB.hpp @@ -114,6 +114,28 @@ public: } protected: + inline bool _compareRecords(const nlohmann::json &a,const nlohmann::json &b) + { + if (a.is_object() == b.is_object()) { + if (a.is_object()) { + if (a.size() != b.size()) + return false; + auto amap = a.get<nlohmann::json::object_t>(); + auto bmap = b.get<nlohmann::json::object_t>(); + for(auto ai=amap.begin();ai!=amap.end();++ai) { + if (ai->first != "revision") { // ignore revision, compare only non-revision-counter fields + auto bi = bmap.find(ai->first); + if ((bi == bmap.end())||(bi->second != ai->second)) + return false; + } + } + return true; + } + return (a == b); + } + return false; + } + struct _Network { _Network() : mostRecentDeauthTime(0) {} |