Remove 'setter' methods of auto-increasing columns

This commit is contained in:
antao 2018-10-31 19:28:27 +08:00 committed by an-tao
parent 143b62b36b
commit 16d6caedb0
2 changed files with 6 additions and 2 deletions

View File

@ -58,7 +58,8 @@ const std::string {{className}}::tableName = "{{tableName}}";
$$<<" return _"<<col._colValName<<";\n";
$$<<"}\n";
if(!col._isAutoVal)
{
$$<<"void "<<className<<"::set"<<col._colTypeName<<"(const "<<col._colType<<" &"<<col._colValName<<") noexcept\n";
$$<<"{\n";
$$<<" _"<<col._colValName<<" = std::make_shared<"<<col._colType<<">("<<col._colValName<<");\n";
@ -72,7 +73,7 @@ const std::string {{className}}::tableName = "{{tableName}}";
$$<<" _"<<col._colValName<<" = std::make_shared<"<<col._colType<<">(std::move("<<col._colValName<<"));\n";
$$<<"}\n";
}
}
}
$$<<"\n";
}

View File

@ -44,9 +44,12 @@ class {{className}}
{
$$<<" const "<<col._colType<<" &getValueOf"<<col._colTypeName<<"(const "<<col._colType<<" &defaultValue="<<col._colType<<"()) const noexcept;\n";
$$<<" std::shared_ptr<const "<<col._colType<<"> get"<<col._colTypeName<<"() const noexcept;\n";
if(!col._isAutoVal)
{
$$<<" void set"<<col._colTypeName<<"(const "<<col._colType<<" &"<<col._colValName<<") noexcept;\n";
if(col._colType=="std::string")
$$<<" void set"<<col._colTypeName<<"("<<col._colType<<" &&"<<col._colValName<<") noexcept;\n";
}
}
else
$$<<" //FIXME!!"<<" getValueOf"<<col._colTypeName<<"() const noexcept;\n";