Fix namespace in model template. (#1107)

This commit is contained in:
NitroMelon 2021-12-05 18:29:29 +08:00 committed by GitHub
parent e9fafc643d
commit 6a55a3aa64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 91 additions and 90 deletions

View File

@ -61,6 +61,7 @@ for(auto convertMethod : convertMethods ) {
%>
using namespace drogon;
using namespace drogon::orm;
using namespace drogon_model::[[dbName]]<%c++
auto &schema=@@.get<std::string>("schema");
if(!schema.empty())
@ -118,7 +119,7 @@ const std::string &[[className]]::getColumnName(size_t index) noexcept(false)
assert(index < metaData_.size());
return metaData_[index].colName_;
}
[[className]]::[[className]](const drogon::orm::Row &r, const ssize_t indexOffset) noexcept
[[className]]::[[className]](const Row &r, const ssize_t indexOffset) noexcept
{
if(indexOffset < 0)
{

View File

@ -226,18 +226,18 @@ auto cols=@@.get<std::vector<ColumnInfo>>("columns");
}
std::string alind(alias.length(), ' ');
%>
void get{%alias%}(const DbClientPtr &clientPtr,
void get{%alias%}(const drogon::orm::DbClientPtr &clientPtr,
{%alind%} const std::function<void({%relationshipClassName%})> &rcb,
{%alind%} const ExceptionCallback &ecb) const;
{%alind%} const drogon::orm::ExceptionCallback &ecb) const;
<%c++
}
else
{
std::string relationshipClassInde(relationshipClassName.length(), ' ');
%>
void get{%relationshipClassName%}(const DbClientPtr &clientPtr,
void get{%relationshipClassName%}(const drogon::orm::DbClientPtr &clientPtr,
{%relationshipClassInde%} const std::function<void({%relationshipClassName%})> &rcb,
{%relationshipClassInde%} const ExceptionCallback &ecb) const;
{%relationshipClassInde%} const drogon::orm::ExceptionCallback &ecb) const;
<%c++
}
}
@ -251,18 +251,18 @@ auto cols=@@.get<std::vector<ColumnInfo>>("columns");
}
std::string alind(alias.length(), ' ');
%>
void get{%alias%}(const DbClientPtr &clientPtr,
void get{%alias%}(const drogon::orm::DbClientPtr &clientPtr,
{%alind%} const std::function<void(std::vector<{%relationshipClassName%}>)> &rcb,
{%alind%} const ExceptionCallback &ecb) const;
{%alind%} const drogon::orm::ExceptionCallback &ecb) const;
<%c++
}
else
{
std::string relationshipClassInde(relationshipClassName.length(), ' ');
%>
void get{%relationshipClassName%}(const DbClientPtr &clientPtr,
void get{%relationshipClassName%}(const drogon::orm::DbClientPtr &clientPtr,
{%relationshipClassInde%} const std::function<void(std::vector<{%relationshipClassName%}>)> &rcb,
{%relationshipClassInde%} const ExceptionCallback &ecb) const;
{%relationshipClassInde%} const drogon::orm::ExceptionCallback &ecb) const;
<%c++
}
}
@ -278,18 +278,18 @@ auto cols=@@.get<std::vector<ColumnInfo>>("columns");
}
std::string alind(alias.length(), ' ');
%>
void get{%alias%}(const DbClientPtr &clientPtr,
void get{%alias%}(const drogon::orm::DbClientPtr &clientPtr,
{%alind%} const std::function<void(std::vector<std::pair<{%relationshipClassName%},{%pivotTableClassName%}>>)> &rcb,
{%alind%} const ExceptionCallback &ecb) const;
{%alind%} const drogon::orm::ExceptionCallback &ecb) const;
<%c++
}
else
{
std::string relationshipClassInde(relationshipClassName.length(), ' ');
%>
void get{%relationshipClassName%}(const DbClientPtr &clientPtr,
void get{%relationshipClassName%}(const drogon::orm::DbClientPtr &clientPtr,
{%relationshipClassInde%} const std::function<void(std::vector<std::pair<{%relationshipClassName%},{%pivotTableClassName%}>>)> &rcb,
{%relationshipClassInde%} const ExceptionCallback &ecb) const;
{%relationshipClassInde%} const drogon::orm::ExceptionCallback &ecb) const;
<%c++
}
}