mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-12-03 12:18:11 +08:00
70eda27427
* Add the ability to create restful API controllers * Update the model.json template file * Modify the 'create controller' command of the drogon_ctl * access column values by column array indexes instead of column names when constructing an instance of a model class * Fix a bug of mysql database * Add some static SQL into models * Add validations to models * Add setToNull method to models * Support 'where in' substatement * Delay rendering from json to the response body. This allows users to modify the json object before sending a response. * Add synchronous method to the HttpClient class
59 lines
1.5 KiB
Plaintext
59 lines
1.5 KiB
Plaintext
/**
|
|
*
|
|
* [[fileName]].cc
|
|
* This file is generated by drogon_ctl
|
|
*
|
|
*/
|
|
|
|
#include "[[fileName]].h"
|
|
#include <string>
|
|
|
|
<%c++
|
|
auto namespaceVector=@@.get<std::vector<std::string>>("namespaceVector");
|
|
std::string namespaceStr;
|
|
for(auto &name:namespaceVector)
|
|
{
|
|
namespaceStr.append(name);
|
|
namespaceStr.append("::");
|
|
}
|
|
if(!namespaceStr.empty())
|
|
{
|
|
namespaceStr.resize(namespaceStr.length()-2);
|
|
$$<<"using namespace "<<namespaceStr<<";\n";
|
|
}
|
|
std::string indentStr(@@.get<std::string>("className").length(), ' ');
|
|
%>
|
|
|
|
void [[className]]::getOne(const HttpRequestPtr &req,
|
|
{%indentStr%} std::function<void(const HttpResponsePtr &)> &&callback,
|
|
{%indentStr%} std::string &&id)
|
|
{
|
|
}
|
|
|
|
void [[className]]::get(const HttpRequestPtr &req,
|
|
{%indentStr%} std::function<void(const HttpResponsePtr &)> &&callback)
|
|
{
|
|
}
|
|
void [[className]]::create(const HttpRequestPtr &req,
|
|
{%indentStr%} std::function<void(const HttpResponsePtr &)> &&callback)
|
|
{
|
|
}
|
|
void [[className]]::updateOne(const HttpRequestPtr &req,
|
|
{%indentStr%} std::function<void(const HttpResponsePtr &)> &&callback,
|
|
{%indentStr%} std::string &&id)
|
|
{
|
|
}
|
|
|
|
/*
|
|
void [[className]]::update(const HttpRequestPtr &req,
|
|
{%indentStr%} std::function<void(const HttpResponsePtr &)> &&callback)
|
|
{
|
|
|
|
}*/
|
|
|
|
void [[className]]::deleteOne(const HttpRequestPtr &req,
|
|
{%indentStr%} std::function<void(const HttpResponsePtr &)> &&callback,
|
|
{%indentStr%} std::string &&id)
|
|
{
|
|
}
|