diff options
Diffstat (limited to 'common/domain')
-rw-r--r-- | common/domain/typeimplementations.cpp | 5 | ||||
-rw-r--r-- | common/domain/typeimplementations_p.h | 18 |
2 files changed, 20 insertions, 3 deletions
diff --git a/common/domain/typeimplementations.cpp b/common/domain/typeimplementations.cpp index e65c998..a8f4baf 100644 --- a/common/domain/typeimplementations.cpp +++ b/common/domain/typeimplementations.cpp | |||
@@ -38,7 +38,7 @@ using namespace Sink::ApplicationDomain; | |||
38 | MAPPER.addMapping<ENTITYTYPE::PROPERTY, Sink::ApplicationDomain::Buffer::ENTITYTYPE, Sink::ApplicationDomain::Buffer::ENTITYTYPE##Builder>(&Sink::ApplicationDomain::Buffer::ENTITYTYPE::LOWERCASEPROPERTY, &Sink::ApplicationDomain::Buffer::ENTITYTYPE##Builder::add_##LOWERCASEPROPERTY); | 38 | MAPPER.addMapping<ENTITYTYPE::PROPERTY, Sink::ApplicationDomain::Buffer::ENTITYTYPE, Sink::ApplicationDomain::Buffer::ENTITYTYPE##Builder>(&Sink::ApplicationDomain::Buffer::ENTITYTYPE::LOWERCASEPROPERTY, &Sink::ApplicationDomain::Buffer::ENTITYTYPE##Builder::add_##LOWERCASEPROPERTY); |
39 | 39 | ||
40 | typedef IndexConfig<Mail, | 40 | typedef IndexConfig<Mail, |
41 | ValueIndex<Mail::Date>, | 41 | SortedIndex<Mail::Date>, |
42 | ValueIndex<Mail::Folder>, | 42 | ValueIndex<Mail::Folder>, |
43 | ValueIndex<Mail::ParentMessageId>, | 43 | ValueIndex<Mail::ParentMessageId>, |
44 | ValueIndex<Mail::MessageId>, | 44 | ValueIndex<Mail::MessageId>, |
@@ -64,7 +64,8 @@ typedef IndexConfig<Addressbook, | |||
64 | > AddressbookIndexConfig; | 64 | > AddressbookIndexConfig; |
65 | 65 | ||
66 | typedef IndexConfig<Event, | 66 | typedef IndexConfig<Event, |
67 | ValueIndex<Event::Uid> | 67 | ValueIndex<Event::Uid>, |
68 | SortedIndex<Event::StartTime> | ||
68 | > EventIndexConfig; | 69 | > EventIndexConfig; |
69 | 70 | ||
70 | typedef IndexConfig<Todo, | 71 | typedef IndexConfig<Todo, |
diff --git a/common/domain/typeimplementations_p.h b/common/domain/typeimplementations_p.h index 6f77a2d..fc08048 100644 --- a/common/domain/typeimplementations_p.h +++ b/common/domain/typeimplementations_p.h | |||
@@ -62,7 +62,7 @@ public: | |||
62 | }; | 62 | }; |
63 | 63 | ||
64 | 64 | ||
65 | template <typename Property, typename SortProperty> | 65 | template <typename Property, typename SortProperty = void> |
66 | class SortedIndex | 66 | class SortedIndex |
67 | { | 67 | { |
68 | public: | 68 | public: |
@@ -78,6 +78,22 @@ public: | |||
78 | } | 78 | } |
79 | }; | 79 | }; |
80 | 80 | ||
81 | template <typename SortProperty> | ||
82 | class SortedIndex<SortProperty, void> | ||
83 | { | ||
84 | public: | ||
85 | static void configure(TypeIndex &index) | ||
86 | { | ||
87 | index.addSortedProperty<SortProperty>(); | ||
88 | } | ||
89 | |||
90 | template <typename EntityType> | ||
91 | static QMap<QByteArray, int> databases() | ||
92 | { | ||
93 | return {{QByteArray{EntityType::name} +".index." + SortProperty::name + ".sorted", 1}}; | ||
94 | } | ||
95 | }; | ||
96 | |||
81 | template <typename Property, typename SecondaryProperty> | 97 | template <typename Property, typename SecondaryProperty> |
82 | class SecondaryIndex | 98 | class SecondaryIndex |
83 | { | 99 | { |