25#ifndef ROUTER_SRC_REST_MRS_SRC_HELPER_TO_SQLSTRING_H_
26#define ROUTER_SRC_REST_MRS_SRC_HELPER_TO_SQLSTRING_H_
32#include <rapidjson/document.h>
45template <
typename Stream,
typename Value>
46Stream &
to_stream(Stream &stream,
const rapidjson::Value &v,
50 }
else if (v.IsBool()) {
52 }
else if (v.IsString()) {
53 stream << v.GetString();
54 }
else if (v.IsUint()) {
55 stream << v.GetUint();
56 }
else if (v.IsInt()) {
58 }
else if (v.IsUint64()) {
59 stream << v.GetUint64();
60 }
else if (v.IsInt64()) {
61 stream << v.GetInt64();
62 }
else if (v.IsFloat()) {
63 stream << v.GetFloat();
64 }
else if (v.IsDouble()) {
65 stream << v.GetDouble();
66 }
else if (v.IsArray() || v.IsObject()) {
69 using namespace std::string_literals;
70 throw std::runtime_error(
71 "JSON value to SQLString, received unsupported type:"s +
82 const rapidjson::Value &v);
86 const std::pair<rapidjson::Value *, mrs::database::entry::ColumnType> &v);
Definition: utils_sqlstring.h:67
static std::string to_string(const LEX_STRING &str)
Definition: lex_string.h:50
Define rapidjson::SizeType to be std::uint64_t.
mysqlrouter::sqlstring & operator<<(mysqlrouter::sqlstring &sql, const rapidjson::Value &v)
Definition: to_sqlstring.cc:39
std::string to_string(const rapidjson::Value &value)
Definition: rapid_json_to_text.h:67
Stream & to_stream(Stream &stream, const rapidjson::Value &v, const Value &k_true, const Value &k_false)
Definition: to_sqlstring.h:46
const std::string k_true
Definition: to_string.h:34
const std::string k_false
Definition: to_string.h:35