MySQL 8.4.2
Source Code Documentation
Json_diff Class Referencefinal

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_diffoperator= (Json_diff &&) noexcept=default
 
 Json_diff (const Json_diff &)=delete
 
Json_diffoperator= (const Json_diff &)=delete
 
const Json_pathpath () 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_domm_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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Json_diff() [1/3]

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.

Parameters
paththe path that is changed
operationthe operation to perform on the path
valuethe new value in the path (the Json_diff object takes over the ownership of the value)

◆ ~Json_diff()

Json_diff::~Json_diff ( )
default

◆ Json_diff() [2/3]

Json_diff::Json_diff ( Json_diff &&  )
defaultnoexcept

◆ Json_diff() [3/3]

Json_diff::Json_diff ( const Json_diff )
delete

Member Function Documentation

◆ binary_length()

size_t Json_diff::binary_length ( ) const

◆ operation()

enum_json_diff_operation Json_diff::operation ( ) const
inline

Get the operation that is performed on the path.

◆ operator=() [1/2]

Json_diff & Json_diff::operator= ( const Json_diff )
delete

◆ operator=() [2/2]

Json_diff & Json_diff::operator= ( Json_diff &&  )
defaultnoexcept

◆ path()

const Json_path & Json_diff::path ( ) const
inline

Get the path that is changed by this diff.

◆ value()

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.

See also
Json_wrapper::set_alias()

◆ write_binary()

bool Json_diff::write_binary ( String to) const

Serialize this Json_diff object and append to the given string.

Parameters
toThe String to append to
Return values
falseSuccess
trueFailure, meaning out of memory

Member Data Documentation

◆ ENCODED_OPERATION_BYTES

const size_t Json_diff::ENCODED_OPERATION_BYTES = 1
staticprivate

The length of the operation when encoded in binary format.

◆ m_operation

enum_json_diff_operation Json_diff::m_operation
private

The operation to perform on the changed path.

◆ m_path

Json_path Json_diff::m_path
private

The path that is changed.

◆ m_value

std::unique_ptr<Json_dom> Json_diff::m_value
private

The new value to add to the changed path.


The documentation for this class was generated from the following files: