add make_query without params
This commit is contained in:
parent
9246c12ebc
commit
ebdf386ba2
@ -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))
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user