Ditto 1.1.3
LiveQuery.hpp
1#ifndef _DITTO_LIVE_QUERY_
2#define _DITTO_LIVE_QUERY_
3
4#include "Document.hpp"
5#include "LiveQueryEvent.hpp"
6#include "LiveQueryMove.hpp"
7#include "SingleDocumentLiveQueryEvent.hpp"
8#include "Subscription.hpp"
9
10#include "json.hpp"
11
12#include <functional>
13#include <memory>
14#include <string>
15#include <vector>
16
17#ifdef __OBJC__
18#warning FIXME: remove include
19#endif
20#include "dittoffi.hpp"
21
22namespace ditto {
23class DittoHandleWrapper;
24
30 std::function<void(std::shared_ptr<Document>, SingleDocumentLiveQueryEvent)>
31 fn;
32};
33
40 std::function<void(std::shared_ptr<Document>, SingleDocumentLiveQueryEvent,
41 std::function<void()> &)>
42 fn;
43};
44
50 std::function<void(std::vector<Document>, LiveQueryEvent)> fn;
51};
52
59 std::function<void(std::vector<Document>, LiveQueryEvent,
60 std::function<void()> &)>
61 fn;
62};
63
72class LiveQuery {
73 friend class PendingCursorOperation;
74 friend class PendingIDSpecificOperation;
75
76public:
83 void stop();
84
85 ~LiveQuery();
86
87private:
88 LiveQuery(std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper,
89 std::string query, nlohmann::json query_args, std::string coll_name,
90 std::vector<COrderByParam_t> &order_by, int32_t limit,
91 uint32_t offset, LiveQueryAvailability_t availability,
92 Subscription *subscription,
94 class LiveQueryCtx;
95 LiveQueryCtx *ctx;
96 bool stopped;
97};
98
99} // namespace ditto
100
101#endif
The events that you receive when dealing with live queries.
Definition: LiveQueryEvent.hpp:15
The type that is returned when calling Collection::observe. It handles the logic for calling the even...
Definition: LiveQuery.hpp:72
void stop()
Stop the live query from delivering updates.
Definition: LiveQuery.cpp:200
These objects are returned when using find-like functionality on Collection objects.
Definition: PendingCursorOperation.hpp:49
These objects are returned when using Collection::find_by_id functionality.
Definition: PendingIDSpecificOperation.hpp:43
Provides information about a live query event relating to a single document live query.
Definition: SingleDocumentLiveQueryEvent.hpp:16
While Subscription objects remain in scope they ensure that documents in the collection specified,...
Definition: Subscription.hpp:17
basic_json<> json
default JSON class
Definition: json.hpp:2933
A thin wrapper around a function that will get called when there are updates relating to a live query...
Definition: LiveQuery.hpp:49
A thin wrapper around a function that will get called when there are updates relating to a live query...
Definition: LiveQuery.hpp:58
A thin wrapper around a function that will get called when there are updates relating to a live query...
Definition: LiveQuery.hpp:29
A thin wrapper around a function that will get called when there are updates relating to a live query...
Definition: LiveQuery.hpp:39