8#ifndef BOOST_SQLITE_JSON_HPP
9#define BOOST_SQLITE_JSON_HPP
11#include <boost/sqlite/detail/config.hpp>
12#include <boost/sqlite/field.hpp>
13#include <boost/sqlite/value.hpp>
14#include <boost/json/fwd.hpp>
15#include <boost/json/storage_ptr.hpp>
17BOOST_SQLITE_BEGIN_NAMESPACE
24constexpr int json_subtype =
static_cast<int>(
'J');
26BOOST_SQLITE_DECL
void tag_invoke(
const struct set_result_tag &, sqlite3_context * ctx,
const json::value & value);
30inline bool is_json(
const value & v) {
return v.type() == value_type::text && v.subtype() == json_subtype; }
31inline bool is_json(
const field & f) {
return f.type() == value_type::text && f.get_value().subtype() == json_subtype; }
36BOOST_SQLITE_DECL json::value
as_json(
const value & v, json::storage_ptr ptr = {});
37BOOST_SQLITE_DECL json::value
as_json(
const field & f, json::storage_ptr ptr = {});
40BOOST_SQLITE_DECL
void tag_invoke(
const json::value_from_tag &, json::value& val,
const value & f);
41BOOST_SQLITE_DECL
void tag_invoke(
const json::value_from_tag &, json::value& val,
const field & f);
42BOOST_SQLITE_DECL
void tag_invoke(
const json::value_from_tag &, json::value& val, resultset && rs);
44BOOST_SQLITE_END_NAMESPACE
json::value as_json(const value &v, json::storage_ptr ptr={})
Convert the value or field to a json.
bool is_json(const value &v)
Check if the value or field is a json.
A holder for a sqlite field, i.e. something returned from a query.
A holder for a sqlite values used for internal APIs.