1#ifndef DITTO_WRITE_TRANSACTION_PENDING_CURSOR_OPERATION_H
2#define DITTO_WRITE_TRANSACTION_PENDING_CURSOR_OPERATION_H
5#include "DocumentId.hpp"
6#include "MutableDocument.hpp"
7#include "SortDirection.hpp"
8#include "UpdateResult.hpp"
9#include "WriteTransaction.hpp"
14#include <unordered_map>
18class DittoHandleWrapper;
28class DITTO_DEPRECATED_BECAUSE(
29 "Use DQL (Ditto Query Language) instead. For more information see: "
30 "https://ditto.com/link/legacy-to-dql-guide")
31 WriteTransactionPendingCursorOperation {
32 DITTO_DISABLE_DEPRECATED_WARNINGS(
"The legacy query API is deprecated")
34 friend class ScopedWriteTransaction;
36 nlohmann::json query_args;
42 WriteTransactionPendingCursorOperation(
44 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper,
47 WriteTransactionPendingCursorOperation(
48 WriteTransactionPendingCursorOperation &&other)
noexcept;
49 WriteTransactionPendingCursorOperation &
50 operator=(WriteTransactionPendingCursorOperation &&other)
noexcept;
53 std::unique_ptr<Impl> impl_;
56 ~WriteTransactionPendingCursorOperation();
79 WriteTransactionPendingCursorOperation &
limit(uint32_t
limit);
112 WriteTransactionPendingCursorOperation &
sort(std::string
query,
122 std::vector<Document>
exec()
const;
134 std::unordered_map<DocumentId, std::vector<std::unique_ptr<UpdateResult>>,
136 update(std::function<
void(std::vector<MutableDocument> &)> fn)
const;
152 std::vector<DocumentId>
evict()
const;
154 DITTO_REENABLE_WARNINGS
WriteTransaction exposes functionality that allows you to perform multiple operations on the store wi...
Definition WriteTransaction.hpp:30
WriteTransactionPendingCursorOperation & limit(uint32_t limit)
Limit the number of documents that get returned when querying a collection for matching documents.
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.
std::vector< DocumentId > remove() const
Remove all documents that match the query generated by the preceding function chaining.
WriteTransactionPendingCursorOperation & sort(std::string query, SortDirection direction)
Sort the documents that match the query provided in the preceding find-like function call.
std::string query
Definition WriteTransactionPendingCursorOperation.hpp:68
std::vector< DocumentId > evict() const
Evict all documents that match the query generated by the preceding function chaining.
std::string collection_name
Definition WriteTransactionPendingCursorOperation.hpp:62
std::vector< Document > exec() const
Execute the query generated by the preceding function chaining and return the list of matching docume...
WriteTransactionPendingCursorOperation & offset(uint32_t offset)
Offset the resulting set of matching documents.
Namespace for the Ditto C++ SDK types and functions.
Definition AbstractDocumentPath.hpp:19
SortDirection
Definition SortDirection.hpp:16