Ditto 4.6.0
Loading...
Searching...
No Matches
WriteTransactionPendingCursorOperation.hpp
1#ifndef _DITTO_WRITE_TRANSACTION_PENDING_CURSOR_OPERATION_
2#define _DITTO_WRITE_TRANSACTION_PENDING_CURSOR_OPERATION_
3
4#include "Document.hpp"
5#include "DocumentId.hpp"
6#include "MutableDocument.hpp"
7#include "SortDirection.hpp"
8#include "UpdateResult.hpp"
9#include "WriteTransaction.hpp"
10
11#include <functional>
12#include <memory>
13#include <string>
14#include <unordered_map>
15#include <vector>
16
17namespace ditto {
18class DittoHandleWrapper;
19
26 friend class ScopedWriteTransaction;
27
28 nlohmann::json query_args;
29 WriteTransaction &base_transaction;
30 uint32_t _offset = 0;
31 int32_t _limit = -1;
32
34 std::string collection_name, std::string query, nlohmann::json query_args,
35 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper,
36 WriteTransaction &base_transaction);
37
42
43 class Impl;
44 std::unique_ptr<Impl> impl_;
45
46public:
48
52 std::string collection_name;
53
57 std::string query;
58
69
86
102 SortDirection direction);
103
111 std::vector<Document> exec() const;
112
123 std::unordered_map<DocumentId, std::vector<std::unique_ptr<UpdateResult>>,
124 DocumentIdHasher>
125 update(std::function<void(std::vector<MutableDocument> &)> fn) const;
126
133 std::vector<DocumentId> remove() const;
134
141 std::vector<DocumentId> evict() const;
142};
143} // namespace ditto
144#endif
ScopedWriteTransaction exposes functionality that allows you to perform multiple operations on the st...
Definition ScopedWriteTransaction.hpp:23
WriteTransaction exposes functionality that allows you to perform multiple operations on the store wi...
Definition WriteTransaction.hpp:25
These objects are returned when using find-like functionality on ScopedWriteTransactions....
Definition WriteTransactionPendingCursorOperation.hpp:25
WriteTransactionPendingCursorOperation & limit(uint32_t limit)
Limit the number of documents that get returned when querying a collection for matching documents.
Definition WriteTransactionPendingCursorOperation.cpp:68
std::unordered_map< DocumentId, std::vector< std::unique_ptr< UpdateResult > >, DocumentIdHasher > update(std::function< void(std::vector< MutableDocument > &)> fn) const
Update documents that match the query generated by the preceding function chaining.
Definition WriteTransactionPendingCursorOperation.cpp:88
std::vector< DocumentId > remove() const
Remove all documents that match the query generated by the preceding function chaining.
Definition WriteTransactionPendingCursorOperation.cpp:105
WriteTransactionPendingCursorOperation & sort(std::string query, SortDirection direction)
Sort the documents that match the query provided in the preceding find-like function call.
Definition WriteTransactionPendingCursorOperation.cpp:74
std::string query
Definition WriteTransactionPendingCursorOperation.hpp:57
std::vector< DocumentId > evict() const
Evict all documents that match the query generated by the preceding function chaining.
Definition WriteTransactionPendingCursorOperation.cpp:117
std::string collection_name
Definition WriteTransactionPendingCursorOperation.hpp:52
std::vector< Document > exec() const
Execute the query generated by the preceding function chaining and return the list of matching docume...
Definition WriteTransactionPendingCursorOperation.cpp:80
WriteTransactionPendingCursorOperation & offset(uint32_t offset)
Offset the resulting set of matching documents.
Definition WriteTransactionPendingCursorOperation.cpp:62
basic_json<> json
default JSON class
Definition json.hpp:2933
Definition Arc.hpp:10