Ditto 2.0.0-alpha1
MutableRga.hpp
1
2#ifndef _DITTO_MUTABLE_RGA_
3#define _DITTO_MUTABLE_RGA_
4
5#include "MutableDocumentPath.hpp"
6#include "Rga.hpp"
7#include "json.hpp"
8
9#include <cstddef>
10#include <vector>
11
12namespace ditto {
13
14class MutableRga : public Rga {
15 friend class MutableDocumentPath;
16
17public:
18 void set(std::size_t index, nlohmann::json value);
19 void remove(std::size_t index);
29 void insert(std::size_t index, nlohmann::json value);
40 void push(nlohmann::json value);
51
52private:
53 std::string indexed_path(std::size_t index);
54 MutableRga(const nlohmann::json &info, MutableDocumentPath doc_path);
55 MutableDocumentPath doc_path;
56};
57
58} // namespace ditto
59
60#endif
Provides an interface to specify a path to a key in a document that you can then call various update ...
Definition: MutableDocumentPath.hpp:32
Definition: MutableRga.hpp:14
nlohmann::json pop()
Pop a value off the end of an array at the document's key defined by the preceding subscripting....
Definition: MutableRga.cpp:40
void insert(std::size_t index, nlohmann::json value)
Inserts a value into an array at the index defined by the preceding subscripting. This will only succ...
Definition: MutableRga.cpp:30
void push(nlohmann::json value)
Push a value on to the end of an array at the document's key defined by the preceding subscripting....
Definition: MutableRga.cpp:35
Represents a CRDT Replicated Growable Array (RGA) that can be upserted as part of a document or assig...
Definition: Rga.hpp:16
basic_json<> json
default JSON class
Definition: json.hpp:2933