MySQL 9.1.0
Source Code Documentation
|
A class that represents a logical change to a JSON document. More...
#include <json_diff.h>
Public Member Functions | |
Json_diff (const Json_seekable_path &path, enum_json_diff_operation operation, std::unique_ptr< Json_dom > value) | |
Construct a Json_diff object. More... | |
~Json_diff () | |
Json_diff (Json_diff &&) noexcept=default | |
Json_diff & | operator= (Json_diff &&) noexcept=default |
Json_diff (const Json_diff &)=delete | |
Json_diff & | operator= (const Json_diff &)=delete |
const Json_path & | path () const |
Get the path that is changed by this diff. More... | |
enum_json_diff_operation | operation () const |
Get the operation that is performed on the path. More... | |
Json_wrapper | value () const |
Get a Json_wrapper representing the new value to add to the path. More... | |
size_t | binary_length () const |
bool | write_binary (String *to) const |
Serialize this Json_diff object and append to the given string. More... | |
Private Attributes | |
Json_path | m_path |
The path that is changed. More... | |
enum_json_diff_operation | m_operation |
The operation to perform on the changed path. More... | |
std::unique_ptr< Json_dom > | m_value |
The new value to add to the changed path. More... | |
Static Private Attributes | |
static const size_t | ENCODED_OPERATION_BYTES = 1 |
The length of the operation when encoded in binary format. More... | |
A class that represents a logical change to a JSON document.
It is used by row-based replication to send information about changes in JSON documents without sending the whole updated document.
Json_diff::Json_diff | ( | const Json_seekable_path & | path, |
enum_json_diff_operation | operation, | ||
std::unique_ptr< Json_dom > | value | ||
) |
Construct a Json_diff object.
path | the path that is changed |
operation | the operation to perform on the path |
value | the new value in the path (the Json_diff object takes over the ownership of the value) |
|
default |
|
defaultnoexcept |
|
delete |
size_t Json_diff::binary_length | ( | ) | const |
|
inline |
Get the operation that is performed on the path.
|
inline |
Get the path that is changed by this diff.
Json_wrapper Json_diff::value | ( | ) | const |
Get a Json_wrapper representing the new value to add to the path.
The wrapper is an alias, so the ownership of the contained Json_dom is retained by the Json_diff object.
bool Json_diff::write_binary | ( | String * | to | ) | const |
Serialize this Json_diff object and append to the given string.
to | The String to append to |
false | Success |
true | Failure, meaning out of memory |
|
staticprivate |
The length of the operation when encoded in binary format.
|
private |
The operation to perform on the changed path.
|
private |
The path that is changed.
|
private |
The new value to add to the changed path.