1#ifndef JSON_DIFF_INCLUDED
2#define JSON_DIFF_INCLUDED
105 std::unique_ptr<Json_dom>
value);
146 typedef std::vector<Json_diff, allocator_type>
vector;
169 std::unique_ptr<Json_dom> dom);
244 const char *field_name);
320std::optional<ReadJsonDiffResult>
read_json_diff(
const unsigned char *pos,
Vector of logical diffs describing changes to a JSON column.
Definition: json_diff.h:141
std::vector< Json_diff, allocator_type > vector
Type of the underlying vector.
Definition: json_diff.h:146
size_t m_binary_length
Length in bytes of the binary representation, not counting the 4 bytes length.
Definition: json_diff.h:255
vector::iterator iterator
Type of iterator over the underlying vector.
Definition: json_diff.h:148
const_iterator end() const
Definition: json_diff.h:193
static const size_t ENCODED_LENGTH_BYTES
The length of the field where the total length is encoded.
Definition: json_diff.h:258
void add_diff(Json_diff diff)
Append a new diff at the end of this vector.
Definition: json_diff.cc:269
size_t binary_length(bool include_metadata=true) const
Return the length of the binary representation of this Json_diff_vector.
Definition: json_diff.cc:290
Mem_root_allocator< Json_diff > allocator_type
Type of the allocator for the underlying invector.
Definition: json_diff.h:144
size_t size() const
Return the number of elements in the vector.
Definition: json_diff.h:180
vector::const_iterator const_iterator
Type of iterator over the underlying vector.
Definition: json_diff.h:150
Json_diff_vector(allocator_type arg)
Constructor.
Definition: json_diff.cc:261
const_iterator begin() const
Definition: json_diff.h:190
Json_diff & at(size_t pos)
Return the element at the given position.
Definition: json_diff.h:187
vector m_vector
Definition: json_diff.h:251
bool write_binary(String *to) const
Serialize this Json_diff_vector into the given String.
Definition: json_diff.cc:294
static const Json_diff_vector EMPTY_JSON_DIFF_VECTOR
An empty diff vector (having no diffs).
Definition: json_diff.h:247
void clear()
Clear the vector.
Definition: json_diff.cc:285
bool read_binary(const char **from, const struct TABLE *table, const char *field_name)
De-serialize Json_diff objects from the given String into this Json_diff_vector.
Definition: json_diff.cc:316
A class that represents a logical change to a JSON document.
Definition: json_diff.h:84
size_t binary_length() const
Definition: json_diff.cc:126
Json_wrapper value() const
Get a Json_wrapper representing the new value to add to the path.
Definition: json_diff.cc:69
static const size_t ENCODED_OPERATION_BYTES
The length of the operation when encoded in binary format.
Definition: json_diff.h:93
const Json_path & path() const
Get the path that is changed by this diff.
Definition: json_diff.h:114
std::unique_ptr< Json_dom > m_value
The new value to add to the changed path.
Definition: json_diff.h:90
Json_path m_path
The path that is changed.
Definition: json_diff.h:86
bool write_binary(String *to) const
Serialize this Json_diff object and append to the given string.
Definition: json_diff.cc:172
enum_json_diff_operation m_operation
The operation to perform on the changed path.
Definition: json_diff.h:88
enum_json_diff_operation operation() const
Get the operation that is performed on the path.
Definition: json_diff.h:117
Json_diff(Json_diff &&) noexcept=default
Json_diff(const Json_seekable_path &path, enum_json_diff_operation operation, std::unique_ptr< Json_dom > value)
Construct a Json_diff object.
Definition: json_diff.cc:58
JSON DOM abstract base class.
Definition: json_dom.h:172
A JSON path expression.
Definition: json_path.h:350
A path expression which can be used to seek to a position inside a JSON value.
Definition: json_path.h:295
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1150
Mem_root_allocator is a C++ STL memory allocator based on MEM_ROOT.
Definition: mem_root_allocator.h:68
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
static Bigint * diff(Bigint *a, Bigint *b, Stack_alloc *alloc)
Definition: dtoa.cc:1081
enum_json_diff_status apply_json_diff(const Json_diff &diff, Json_dom *dom)
Apply one JSON diff to the DOM provided.
Definition: json_diff.cc:455
enum_json_diff_status
The result of applying JSON diffs on a JSON value using apply_json_diff().
Definition: json_diff.h:264
@ REJECTED
One of the diffs was rejected.
@ ERROR
An error was raised while applying one of the diffs.
@ SUCCESS
The JSON diffs were applied and the JSON value in the column was updated successfully.
std::optional< ReadJsonDiffResult > read_json_diff(const unsigned char *pos, size_t length)
Read one JSON diff from a buffer.
Definition: json_diff.cc:358
enum_json_diff_operation
Enum that describes what kind of operation a Json_diff object represents.
Definition: json_diff.h:52
@ REPLACE
The JSON value in the given path is replaced with a new value.
@ INSERT
Add a new element at the given path.
@ REMOVE
The JSON value at the given path is removed from an array or object.
static const int JSON_DIFF_OPERATION_COUNT
The number of elements of the enumeration above.
Definition: json_diff.h:77
This file contains interface support for the JSON path abstraction.
static char * path
Definition: mysqldump.cc:149
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
The result of a call to read_json_diff().
Definition: json_diff.h:302
Json_diff diff
The JSON diff that was read from the buffer.
Definition: json_diff.h:304
size_t bytes_read
The number of bytes read from the buffer.
Definition: json_diff.h:306