This commit is contained in:
Andrey Zimin 2024-05-15 18:55:51 +03:00
parent 478e417dc1
commit 04de2af292
3 changed files with 11 additions and 9 deletions

View File

@ -3,6 +3,8 @@
#include "hack/utils/singleton.hpp"
#include "hack/utils/func_query.hpp"
#include "nlohmann/json.hpp"
int f(int a)
{
hack::log()("f implementatioln");
@ -54,12 +56,12 @@ auto main(int argc, char *argv[]) -> int
hack::log("")("func_concat result: ", combine(a), a);
}
{// ex: utils::exec
hack::log()(hack::utils::unix_cmd("ls"));
hack::log()(hack::utils::unix_cmd("pwd"));
auto t = hack::utils::unix_cmd("pwd");
hack::log::type_trace(t);
}
// {// ex: utils::exec
// hack::log()(hack::utils::unix_cmd("ls"));
// hack::log()(hack::utils::unix_cmd("pwd"));
// auto t = hack::utils::unix_cmd("pwd");
// hack::log::type_trace(t);
// }
{// ex: counter
counter_test a, b, c;
@ -88,7 +90,7 @@ auto main(int argc, char *argv[]) -> int
hack::log()("JSON sting", query);
nlohmann::json js { "test", "data" };
query = hack::utils::make_query("super_function", 1'000'000, 123.3f, js);
query = hack::utils::make_query<nlohmann::json>("super_function", 1'000'000, 123.3f, js);
hack::log()("JSON", query);
query = hack::utils::make_query("super_function");

@ -1 +1 @@
Subproject commit b14e81244d4955707d7cb5a4de12f1dfac9556f6
Subproject commit 478e417dc12c27b2029fa81c5e2c9b08ae5fd01f

View File

@ -63,7 +63,7 @@ namespace hack::utils
template<typename Json>
inline std::string make_one(const Json& f)
{
auto f_str = f;
auto f_str = f.dump();
f_str = std::regex_replace(f_str, std::regex("'"), "[quote]");
return hack::string::str_concat + "'" + f_str + "'::jsonb,";
}