diff options
author | Minijackson <minijackson@riseup.net> | 2018-05-25 11:28:22 +0200 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2018-05-25 11:29:30 +0200 |
commit | 00717f6c8b8a9c6dbd56a80d685c5082fc03f6a5 (patch) | |
tree | eb0871b7518234c3db3e2d647b0b7c020253accb /common/typeindex.h | |
parent | c095e82143fd16c84263d990b96590b3b0d12a78 (diff) | |
download | sink-00717f6c8b8a9c6dbd56a80d685c5082fc03f6a5.tar.gz sink-00717f6c8b8a9c6dbd56a80d685c5082fc03f6a5.zip |
Implement range queries
Diffstat (limited to 'common/typeindex.h')
-rw-r--r-- | common/typeindex.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/common/typeindex.h b/common/typeindex.h index b8b4d52..793dc1e 100644 --- a/common/typeindex.h +++ b/common/typeindex.h | |||
@@ -38,6 +38,8 @@ public: | |||
38 | 38 | ||
39 | template <typename T> | 39 | template <typename T> |
40 | void addProperty(const QByteArray &property); | 40 | void addProperty(const QByteArray &property); |
41 | template <typename T> | ||
42 | void addSortedProperty(const QByteArray &property); | ||
41 | template <typename T, typename S> | 43 | template <typename T, typename S> |
42 | void addPropertyWithSorting(const QByteArray &property, const QByteArray &sortProperty); | 44 | void addPropertyWithSorting(const QByteArray &property, const QByteArray &sortProperty); |
43 | 45 | ||
@@ -54,9 +56,9 @@ public: | |||
54 | } | 56 | } |
55 | 57 | ||
56 | template <typename T> | 58 | template <typename T> |
57 | void addPropertyWithSorting() | 59 | void addSortedProperty() |
58 | { | 60 | { |
59 | addPropertyWithSorting<typename T::Type>(T::name); | 61 | addSortedProperty<typename T::Type>(T::name); |
60 | } | 62 | } |
61 | 63 | ||
62 | template <typename Left, typename Right> | 64 | template <typename Left, typename Right> |
@@ -112,14 +114,17 @@ private: | |||
112 | friend class Sink::Storage::EntityStore; | 114 | friend class Sink::Storage::EntityStore; |
113 | void updateIndex(bool add, const QByteArray &identifier, const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Storage::DataStore::Transaction &transaction, const QByteArray &resourceInstanceId); | 115 | void updateIndex(bool add, const QByteArray &identifier, const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Storage::DataStore::Transaction &transaction, const QByteArray &resourceInstanceId); |
114 | QByteArray indexName(const QByteArray &property, const QByteArray &sortProperty = QByteArray()) const; | 116 | QByteArray indexName(const QByteArray &property, const QByteArray &sortProperty = QByteArray()) const; |
117 | QByteArray sortedIndexName(const QByteArray &property) const; | ||
115 | Sink::Log::Context mLogCtx; | 118 | Sink::Log::Context mLogCtx; |
116 | QByteArray mType; | 119 | QByteArray mType; |
117 | QByteArrayList mProperties; | 120 | QByteArrayList mProperties; |
118 | QMap<QByteArray, QByteArray> mSortedProperties; | 121 | QByteArrayList mSortedProperties; |
122 | QMap<QByteArray, QByteArray> mGroupedSortedProperties; | ||
119 | //<Property, ResultProperty> | 123 | //<Property, ResultProperty> |
120 | QMap<QByteArray, QByteArray> mSecondaryProperties; | 124 | QMap<QByteArray, QByteArray> mSecondaryProperties; |
121 | QList<Sink::Indexer::Ptr> mCustomIndexer; | 125 | QList<Sink::Indexer::Ptr> mCustomIndexer; |
122 | Sink::Storage::DataStore::Transaction *mTransaction; | 126 | Sink::Storage::DataStore::Transaction *mTransaction; |
123 | QHash<QByteArray, std::function<void(bool, const QByteArray &identifier, const QVariant &value, Sink::Storage::DataStore::Transaction &transaction)>> mIndexer; | 127 | QHash<QByteArray, std::function<void(bool, const QByteArray &identifier, const QVariant &value, Sink::Storage::DataStore::Transaction &transaction)>> mIndexer; |
124 | QHash<QByteArray, std::function<void(bool, const QByteArray &identifier, const QVariant &value, const QVariant &sortValue, Sink::Storage::DataStore::Transaction &transaction)>> mSortIndexer; | 128 | QHash<QByteArray, std::function<void(bool, const QByteArray &identifier, const QVariant &value, Sink::Storage::DataStore::Transaction &transaction)>> mSortIndexer; |
129 | QHash<QByteArray, std::function<void(bool, const QByteArray &identifier, const QVariant &value, const QVariant &sortValue, Sink::Storage::DataStore::Transaction &transaction)>> mGroupedSortIndexer; | ||
125 | }; | 130 | }; |