MySQL 8.4.3
Source Code Documentation
|
Vector of logical diffs describing changes to a JSON column. More...
#include <json_diff.h>
Public Types | |
typedef Mem_root_allocator< Json_diff > | allocator_type |
Type of the allocator for the underlying invector. More... | |
typedef std::vector< Json_diff, allocator_type > | vector |
Type of the underlying vector. More... | |
typedef vector::iterator | iterator |
Type of iterator over the underlying vector. More... | |
typedef vector::const_iterator | const_iterator |
Type of iterator over the underlying vector. More... | |
Public Member Functions | |
Json_diff_vector (allocator_type arg) | |
Constructor. More... | |
void | add_diff (Json_diff diff) |
Append a new diff at the end of this vector. More... | |
void | add_diff (const Json_seekable_path &path, enum_json_diff_operation operation, std::unique_ptr< Json_dom > dom) |
Append a new diff at the end of this vector. More... | |
void | add_diff (const Json_seekable_path &path, enum_json_diff_operation operation) |
Append a new diff at the end of this vector when operation == REMOVE. More... | |
void | clear () |
Clear the vector. More... | |
size_t | size () const |
Return the number of elements in the vector. More... | |
Json_diff & | at (size_t pos) |
Return the element at the given position. More... | |
const_iterator | begin () const |
const_iterator | end () const |
size_t | binary_length (bool include_metadata=true) const |
Return the length of the binary representation of this Json_diff_vector. More... | |
bool | write_binary (String *to) const |
Serialize this Json_diff_vector into the given String. More... | |
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. More... | |
Static Public Attributes | |
static const Json_diff_vector | EMPTY_JSON_DIFF_VECTOR |
An empty diff vector (having no diffs). More... | |
Private Attributes | |
vector | m_vector |
size_t | m_binary_length |
Length in bytes of the binary representation, not counting the 4 bytes length. More... | |
Static Private Attributes | |
static const size_t | ENCODED_LENGTH_BYTES = 4 |
The length of the field where the total length is encoded. More... | |
Vector of logical diffs describing changes to a JSON column.
Type of the allocator for the underlying invector.
typedef vector::const_iterator Json_diff_vector::const_iterator |
Type of iterator over the underlying vector.
typedef vector::iterator Json_diff_vector::iterator |
Type of iterator over the underlying vector.
typedef std::vector<Json_diff, allocator_type> Json_diff_vector::vector |
Type of the underlying vector.
|
explicit |
Constructor.
arg | Mem_root_allocator to use for the vector |
void Json_diff_vector::add_diff | ( | const Json_seekable_path & | path, |
enum_json_diff_operation | operation | ||
) |
Append a new diff at the end of this vector when operation == REMOVE.
path | Path to update |
operation | Operation |
void Json_diff_vector::add_diff | ( | const Json_seekable_path & | path, |
enum_json_diff_operation | operation, | ||
std::unique_ptr< Json_dom > | dom | ||
) |
Append a new diff at the end of this vector.
path | Path to update |
operation | Operation |
dom | New value to insert |
void Json_diff_vector::add_diff | ( | Json_diff | diff | ) |
Append a new diff at the end of this vector.
diff | The diff to add. |
|
inline |
Return the element at the given position.
pos | Position |
|
inline |
size_t Json_diff_vector::binary_length | ( | bool | include_metadata = true | ) | const |
Return the length of the binary representation of this Json_diff_vector.
The binary format has this form:
+--------+--------+--------+ +--------+ | length | diff_1 | diff_2 | ... | diff_N | +--------+--------+--------+ +--------+
This function returns the length of only the diffs, if include_metadata==false. It returns the length of the 'length' field plus the length of the diffs, if include_metadata=true. The value of the 'length' field is exactly the return value from this function when include_metadata=false.
include_metadata | if true, include the length of the length field in the computation, otherwise don't. |
void Json_diff_vector::clear | ( | ) |
Clear the vector.
|
inline |
bool Json_diff_vector::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.
[in,out] | from | Pointer to buffer to read from. The function will move this to point to the next byte to read after those that were read. |
[in] | table | Table structure (used for error messages). |
[in] | field_name | Field name (used for error messages). |
false | Success |
true | Failure (bad format or out of memory) |
|
inline |
Return the number of elements in the vector.
bool Json_diff_vector::write_binary | ( | String * | to | ) | const |
Serialize this Json_diff_vector into the given String.
to | String to which the vector will be appended |
false | Success |
true | Failure (out of memory) |
|
static |
An empty diff vector (having no diffs).
|
staticprivate |
The length of the field where the total length is encoded.
|
private |
Length in bytes of the binary representation, not counting the 4 bytes length.
|
private |