Ditto 4.13.1
 
Loading...
Searching...
No Matches
WriteTransactionPendingIDSpecificOperation.hpp
1#ifndef DITTO_WRITE_TRANSACTION_PENDING_ID_SPECIFIC_OPERATION_H
2#define DITTO_WRITE_TRANSACTION_PENDING_ID_SPECIFIC_OPERATION_H
3
4#include "Document.hpp"
5#include "DocumentId.hpp"
6#include "MutableDocument.hpp"
7#include "UpdateResult.hpp"
8#include "WriteTransaction.hpp"
9
10#include <functional>
11#include <memory>
12#include <string>
13#include <vector>
14
15namespace ditto {
16class DittoHandleWrapper;
17
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 WriteTransactionPendingIDSpecificOperation {
32 DITTO_DISABLE_DEPRECATED_WARNINGS("The legacy query API is deprecated")
33
34 friend class ScopedWriteTransaction;
35
36 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper;
37 // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
38 WriteTransaction &base_transaction;
39
40 WriteTransactionPendingIDSpecificOperation(
42 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper,
43 WriteTransaction &base_transaction);
44
45public:
49 // TODO(v5): make collection_name private and provide a getter
50 std::string collection_name; // NOLINT
51
55 // TODO(v5): make document_id private and provide a getter
57
66 std::shared_ptr<Document> exec() const;
67
80 DITTO_DEPRECATED_BECAUSE("Use `update_v2` instead.")
81 std::vector<std::unique_ptr<UpdateResult>>
82 update(std::function<void(MutableDocument &)> fn) const;
83
94 std::vector<std::unique_ptr<UpdateResult>>
95 update_v2(std::function<void(MutableDocument *)> fn) const;
96
103 bool remove() const;
104
111 bool evict() const;
112
113 DITTO_REENABLE_WARNINGS
114};
115} // namespace ditto
116#endif
This is used as part of update operations for documents.
Definition MutableDocument.hpp:34
WriteTransaction exposes functionality that allows you to perform multiple operations on the store wi...
Definition WriteTransaction.hpp:30
bool remove() const
Remove the document with the matching ID.
bool evict() const
Evict the document with the matching ID.
std::shared_ptr< Document > exec() const
Execute the find operation to return the document with the matching ID, if it exists.
std::string collection_name
Definition WriteTransactionPendingIDSpecificOperation.hpp:50
DocumentId document_id
Definition WriteTransactionPendingIDSpecificOperation.hpp:56
std::vector< std::unique_ptr< UpdateResult > > update(std::function< void(MutableDocument &)> fn) const
Update the document with the matching ID.
std::vector< std::unique_ptr< UpdateResult > > update_v2(std::function< void(MutableDocument *)> fn) const
Update the document with the matching ID.
Namespace for the Ditto C++ SDK types and functions.
Definition AbstractDocumentPath.hpp:19
An identifier for a Document.
Definition DocumentId.hpp:23
Provides information about a successful update operation on a document.
Definition UpdateResult.hpp:35