33#ifndef GUARD_SQLITE_JSON_FTS_HPP_INCLUDED
34#define GUARD_SQLITE_JSON_FTS_HPP_INCLUDED
82 std::string
const &
str() const noexcept {
112 std::string_view value_expr);
130 std::string_view function_name =
"json_contains_value");
150 std::string_view query_expr =
"?");
Helper for composing JSON path expressions compatible with SQLite's JSON1 dialect.
path_builder & key(std::string_view segment)
Appends an object key to the path.
path_builder & index(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).
path_builder()
Constructs a builder positioned at the JSON root ($).
std::string match_expression(std::string_view column_or_table, std::string_view query_expr="?")
Builds a SQL MATCH expression for FTS tables or columns.
bool available(connection &con)
Detects whether the connected SQLite build exposes the FTS5 extension.
void register_rank_function(connection &con, std::string_view function_name="fts_rank")
Registers a custom ranking function compatible with fts5 queries.
std::string extract_expression(std::string_view json_expr, path_builder const &path)
Produces a SQL expression that extracts a JSON value at the given path.
path_builder path()
Convenience shortcut for starting a new JSON path builder rooted at $.
void register_contains_function(connection &con, std::string_view function_name="json_contains_value")
Registers a deterministic SQL scalar function that checks for JSON containment.
std::string contains_expression(std::string_view json_expr, path_builder const &path, std::string_view value_expr)
Produces a SQL expression that compares a JSON value at path with value_expr.
bool available(connection &con)
Detects whether the connected SQLite build exposes the JSON1 extension.
connection is used to open, close, attach and detach a database. Further it has to be passed to all c...