VSQLite++ 0.3
Loading...
Searching...
No Matches
sqlite::v2::json::path_builder Class Reference

Helper for composing JSON path expressions compatible with SQLite's JSON1 dialect. More...

#include <json_fts.hpp>

Collaboration diagram for sqlite::v2::json::path_builder:
Collaboration graph

Public Member Functions

 path_builder ()
 Constructs a builder positioned at the JSON root ($).
path_builderkey (std::string_view segment)
 Appends an object key to the path.
path_builderindex (std::size_t idx)
 Appends an array index access to the path.
std::string const & str () const noexcept
 Returns the current JSON path representation (e.g. $.user.name).

Private Attributes

std::string path_

Detailed Description

Helper for composing JSON path expressions compatible with SQLite's JSON1 dialect.

Instances start at the root ($) and can be extended via key and index. The builder keeps the JSON path in UTF-8 form and automatically quotes segments that require escaping (spaces, punctuation, etc.).

Definition at line 58 of file json_fts.hpp.

Constructor & Destructor Documentation

◆ path_builder()

sqlite::v2::json::path_builder::path_builder ( )

Constructs a builder positioned at the JSON root ($).

Referenced by index(), and key().

Member Function Documentation

◆ index()

path_builder & sqlite::v2::json::path_builder::index ( std::size_t idx)

Appends an array index access to the path.

Parameters
idxZero-based array index to append.
Returns
Reference to the builder for chaining.

References path_builder().

Here is the call graph for this function:

◆ key()

path_builder & sqlite::v2::json::path_builder::key ( std::string_view segment)

Appends an object key to the path.

The key is automatically quoted when it contains characters that need escaping.

Parameters
segmentKey to append.
Returns
Reference to the builder for chaining.

References path_builder().

Here is the call graph for this function:

◆ str()

std::string const & sqlite::v2::json::path_builder::str ( ) const
inlinenoexcept

Returns the current JSON path representation (e.g. $.user.name).

Definition at line 82 of file json_fts.hpp.

References path_.

Member Data Documentation

◆ path_

std::string sqlite::v2::json::path_builder::path_
private

Definition at line 87 of file json_fts.hpp.

Referenced by str().


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