Ditto 3.0.3-alpha2
Document.hpp
1#ifndef _DITTO_DOCUMENT_
2#define _DITTO_DOCUMENT_
3
4#include "DocumentId.hpp"
5#include "DocumentPath.hpp"
6
7#include "json.hpp"
8
9typedef struct CDocument CDocument_t;
10
11namespace ditto {
12
17class Document {
18 friend class DocumentHelpers;
19 friend class DocumentOperator;
20 friend class LiveQuery;
21 friend class QueryOperator;
22 friend class PendingIDSpecificOperation;
23 friend class PendingCursorOperation;
24
25 CDocument_t *document;
26
27 explicit Document(CDocument_t *document);
28
29public:
30 Document(const Document &) = delete;
31 Document(Document &&) noexcept;
32 ~Document();
33
39 DocumentId id() const;
40
46 nlohmann::json value() const;
47
58 DocumentPath operator[](const std::string initial_path);
59};
60} // namespace ditto
61
62#endif
A document belonging to a Collection with an inner value and an identifier (DocumentId).
Definition: Document.hpp:17
DocumentPath operator[](const std::string initial_path)
Used to specify a path to a key in the document that you can subscript further to access a nested key...
Definition: Document.cpp:31
nlohmann::json value() const
Get the document's inner value.
Definition: Document.cpp:24
DocumentId id() const
Get the ID of the document.
Definition: Document.cpp:22
Provides an interface to specify a path to a key in a document that you can then call a function on t...
Definition: DocumentPath.hpp:31
The type that is returned when calling observe_local. It handles the logic for calling the event hand...
Definition: LiveQuery.hpp:108
These objects are returned when using find-like functionality on Collection objects.
Definition: PendingCursorOperation.hpp:44
These objects are returned when using Collection::find_by_id functionality.
Definition: PendingIDSpecificOperation.hpp:40
basic_json<> json
default JSON class
Definition: json.hpp:2933
An identifier for a Document.
Definition: DocumentId.hpp:21