diff --git a/bin/main.cpp b/bin/main.cpp index 014d295..52bd8ac 100644 --- a/bin/main.cpp +++ b/bin/main.cpp @@ -288,6 +288,9 @@ int main(int argc, char *argv[]) } } + hack::log()("============================================================"); + hack::log()("utils::make_query"); + {// ex: query function auto query = hack::utils::make_query("super_function", "1", "two"); hack::log()("query", query); @@ -298,8 +301,14 @@ int main(int argc, char *argv[]) hack::utils::json js { "test", "data" }; query = hack::utils::make_query("super_function", 1, 123.3f, js); hack::log()("query", query); + + query = hack::utils::make_query("super_function"); + hack::log()("query", query); } + hack::log()("============================================================"); + hack::log()("utils::is_link"); + {// ex: is link std::string link { "https://google.com" }; if (hack::security::is_link(link)) diff --git a/src/utils/func_query.hpp b/src/utils/func_query.hpp index 3892b34..75177e0 100644 --- a/src/utils/func_query.hpp +++ b/src/utils/func_query.hpp @@ -42,7 +42,6 @@ namespace hack::utils inline std::string make_one(json f) { std::string f_str = nlohmann::to_string(f); - // f_str.erase(std::remove(f_str.begin(), f_str.end(), '\''), f_str.end()); f_str = std::regex_replace(f_str, std::regex("'"), "[quote]"); return hack::string::str_concat + "'" + f_str + "'::jsonb,"; @@ -70,4 +69,9 @@ namespace hack::utils return query; } + std::string make_query(const std::string func) + { + std::string query = "SELECT s_func." + func + "();"; + return query; + } }