VSQLite++ 0.3
Loading...
Searching...
No Matches
json_fts.hpp File Reference

Convenience helpers for composing JSON1 expressions and working with FTS5 ranks. More...

#include <string>
#include <string_view>
Include dependency graph for json_fts.hpp:

Go to the source code of this file.

Classes

class  sqlite::v2::json::path_builder
 Helper for composing JSON path expressions compatible with SQLite's JSON1 dialect. More...

Namespaces

namespace  sqlite
namespace  sqlite::v2
namespace  sqlite::v2::json
namespace  sqlite::v2::fts

Functions

path_builder sqlite::v2::json::path ()
 Convenience shortcut for starting a new JSON path builder rooted at $.
std::string sqlite::v2::json::extract_expression (std::string_view json_expr, path_builder const &path)
 Produces a SQL expression that extracts a JSON value at the given path.
std::string sqlite::v2::json::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 sqlite::v2::json::available (connection &con)
 Detects whether the connected SQLite build exposes the JSON1 extension.
void sqlite::v2::json::register_contains_function (connection &con, std::string_view function_name="json_contains_value")
 Registers a deterministic SQL scalar function that checks for JSON containment.
bool sqlite::v2::fts::available (connection &con)
 Detects whether the connected SQLite build exposes the FTS5 extension.
std::string sqlite::v2::fts::match_expression (std::string_view column_or_table, std::string_view query_expr="?")
 Builds a SQL MATCH expression for FTS tables or columns.
void sqlite::v2::fts::register_rank_function (connection &con, std::string_view function_name="fts_rank")
 Registers a custom ranking function compatible with fts5 queries.

Detailed Description

Convenience helpers for composing JSON1 expressions and working with FTS5 ranks.

The functions declared here are light wrappers around SQLite's JSON + FTS extensions and are intended to be opt-in utilities for applications that enable those compile-time features.

Definition in file json_fts.hpp.