<%inc#include "create_model.h" using namespace drogon_ctl; %> /** * * [[className]].h * DO NOT EDIT. This file is generated by drogon_ctl * */ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace drogon::orm; namespace drogon_model { namespace [[dbName]] { class [[className]] { public: struct Cols { <%c++ auto cols=@@.get>("columns"); for(size_t i=0;i }; const static int primaryKeyNumber; const static std::string tableName; const static bool hasPrimaryKey; <%c++if(@@.get("hasPrimaryKey")<=1){%> const static std::string primaryKeyName; <%c++if(!@@.get("primaryKeyType").empty()){%> typedef [[primaryKeyType]] PrimaryKeyType; const PrimaryKeyType & getPrimaryKey() const; <%c++}else{%> typedef void PrimaryKeyType; <%c++}%> <%c++}else{ auto pkTypes=@@.get>("primaryKeyType"); std::string typelist; for(size_t i=0;i const static std::vector primaryKeyName; typedef std::tuple<{%typelist%}> PrimaryKeyType;//<%c++ auto pkName=@@.get>("primaryKeyName"); for(size_t i=0;i PrimaryKeyType getPrimaryKey() const; <%c++}%> [[className]](const Row &r) noexcept; [[className]]() = default; <%c++ for(auto col:cols) { $$<<" /** For column "<") { $$<<" ///Return the column value by std::string with binary data\n"; $$<<" std::string getValueOf"< get"<") { $$<<" void set"< static size_t getColumnNumber() noexcept { return {% cols.size() %}; } static const std::string &getColumnName(size_t index) noexcept(false); Json::Value toJson() const; private: friend Mapper<[[className]]>; static const std::vector &insertColumns() noexcept; void outputArgs(drogon::orm::internal::SqlBinder &binder) const; const std::vector updateColumns() const; void updateArgs(drogon::orm::internal::SqlBinder &binder) const; ///For mysql or sqlite3 void updateId(const uint64_t id); <%c++ for(auto col:cols) { if(!col._colType.empty()) $$<<" std::shared_ptr<"< _"< struct MetaData { const std::string _colName; const std::string _colType; const std::string _colDatabaseType; const ssize_t _colLength; const bool _isAutoVal; const bool _isPrimaryKey; const bool _notNull; }; static const std::vector _metaData; bool _dirtyFlag[{%cols.size()%}]={ false }; }; } // namespace [[dbName]] } // namespace drogon_model