From faf3e0c17cc87c768ab9e0772362a1c5141e556f Mon Sep 17 00:00:00 2001 From: Ichiro Date: Fri, 26 Nov 2021 12:29:47 +0900 Subject: [PATCH] Add drogon::orm to models generation (#1092) --- drogon_ctl/templates/model_cc.csp | 2 +- drogon_ctl/templates/model_h.csp | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drogon_ctl/templates/model_cc.csp b/drogon_ctl/templates/model_cc.csp index 3d06d2ce..893c4182 100644 --- a/drogon_ctl/templates/model_cc.csp +++ b/drogon_ctl/templates/model_cc.csp @@ -118,7 +118,7 @@ const std::string &[[className]]::getColumnName(size_t index) noexcept(false) assert(index < metaData_.size()); return metaData_[index].colName_; } -[[className]]::[[className]](const Row &r, const ssize_t indexOffset) noexcept +[[className]]::[[className]](const drogon::orm::Row &r, const ssize_t indexOffset) noexcept { if(indexOffset < 0) { diff --git a/drogon_ctl/templates/model_h.csp b/drogon_ctl/templates/model_h.csp index 16ef8a72..6fd04bae 100644 --- a/drogon_ctl/templates/model_h.csp +++ b/drogon_ctl/templates/model_h.csp @@ -27,7 +27,6 @@ using namespace drogon_ctl; #include #include -using namespace drogon::orm; namespace drogon { namespace orm @@ -129,7 +128,7 @@ auto cols=@@.get>("columns"); * @note If the SQL is not a style of 'select * from table_name ...' (select all * columns by an asterisk), please set the offset to -1. */ - explicit [[className]](const Row &r, const ssize_t indexOffset = 0) noexcept; + explicit [[className]](const drogon::orm::Row &r, const ssize_t indexOffset = 0) noexcept; /** * @brief constructor @@ -297,9 +296,9 @@ auto cols=@@.get>("columns"); } %> private: - friend Mapper<[[className]]>; + friend drogon::orm::Mapper<[[className]]>; #ifdef __cpp_impl_coroutine - friend CoroMapper<[[className]]>; + friend drogon::orm::CoroMapper<[[className]]>; #endif static const std::vector &insertColumns() noexcept; void outputArgs(drogon::orm::internal::SqlBinder &binder) const;