MySQL 8.3.0
Source Code Documentation
Json_path Class Referencefinal

A JSON path expression. More...

#include <json_path.h>

Inheritance diagram for Json_path:
[legend]

Public Member Functions

 Json_path (PSI_memory_key key)
 
 ~Json_path ()
 
 Json_path (Json_path &&other)
 Move constructor. More...
 
Json_pathoperator= (Json_path &&other)
 Move assignment. More...
 
bool append (const Json_path_leg &leg)
 Add a path leg to the end of this path. More...
 
void clear ()
 Resets this to an empty path with no legs. More...
 
bool can_match_many () const
 Return true if the path can match more than one value in a JSON document. More...
 
bool to_string (String *buf) const
 Turn into a human-readable string. More...
 
- Public Member Functions inherited from Json_seekable_path
size_t leg_count () const
 Return the number of legs in this searchable path. More...
 
Json_path_iterator begin () const
 Get an iterator pointing to the first path leg. More...
 
Json_path_iterator end () const
 Get an iterator pointing just past the last path leg. More...
 
const Json_path_leglast_leg () const
 Get a pointer to the last path leg. More...
 

Private Attributes

MEM_ROOT m_mem_root
 A MEM_ROOT in which the Json_path_leg objects pointed to by Json_seekable_path::m_path_legs are allocated. More...
 
PSI_memory_key m_psi_key
 Key used to instrument memory usage. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Json_seekable_path
 Json_seekable_path (PSI_memory_key key)
 
- Protected Attributes inherited from Json_seekable_path
Json_path_leg_pointers m_path_legs
 An array of pointers to the legs of the JSON path. More...
 

Detailed Description

A JSON path expression.

From the user's point of view, a path expression is a string literal with the following structure. We parse this structure into a Json_path object:

pathExpression ::= scope  pathLeg (pathLeg)*

scope ::= dollarSign

pathLeg ::= member | arrayLocation | doubleAsterisk

member ::= period (keyName | asterisk)

arrayLocation ::=
  leftBracket
    (arrayIndex | arrayRange | asterisk)
  rightBracket

arrayIndex ::=
  non-negative-integer |
  last [ minus non-negative-integer ]

arrayRange ::= arrayIndex to arrayIndex

keyName ::= ECMAScript-identifier | ECMAScript-string-literal

doubleAsterisk ::= **

to ::= "to"

last ::= "last"

Constructor & Destructor Documentation

◆ Json_path() [1/2]

Json_path::Json_path ( PSI_memory_key  key)
explicit

◆ ~Json_path()

Json_path::~Json_path ( )
inline

◆ Json_path() [2/2]

Json_path::Json_path ( Json_path &&  other)
inline

Move constructor.

Member Function Documentation

◆ append()

bool Json_path::append ( const Json_path_leg leg)
inline

Add a path leg to the end of this path.

Parameters
[in]legthe leg to add
Returns
false on success, true on error

◆ can_match_many()

bool Json_path::can_match_many ( ) const

Return true if the path can match more than one value in a JSON document.

Return values
trueif the path contains a path leg which is a wildcard, ellipsis or array range
falseotherwise

◆ clear()

void Json_path::clear ( )
inline

Resets this to an empty path with no legs.

◆ operator=()

Json_path & Json_path::operator= ( Json_path &&  other)
inline

Move assignment.

◆ to_string()

bool Json_path::to_string ( String buf) const

Turn into a human-readable string.

Member Data Documentation

◆ m_mem_root

MEM_ROOT Json_path::m_mem_root
private

A MEM_ROOT in which the Json_path_leg objects pointed to by Json_seekable_path::m_path_legs are allocated.

◆ m_psi_key

PSI_memory_key Json_path::m_psi_key
private

Key used to instrument memory usage.


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