/** * * Users.cc * DO NOT EDIT. This file is generated by drogon_ctl * */ #include "Users.h" #include #include #include using namespace drogon_model::postgres; const std::string Users::Cols::user_id = "user_id"; const std::string Users::Cols::user_name = "user_name"; const std::string Users::Cols::password = "password"; const std::string Users::Cols::org_name = "org_name"; const std::string Users::Cols::signature = "signature"; const std::string Users::Cols::avatar_id = "avatar_id"; const std::string Users::Cols::id = "id"; const std::string Users::Cols::salt = "salt"; const std::string Users::Cols::admin = "admin"; const std::string Users::primaryKeyName = "id"; const bool Users::hasPrimaryKey = true; const std::string Users::tableName = "users"; const std::vector Users::_metaData={ {"user_id","std::string","character varying",32,0,0,0}, {"user_name","std::string","character varying",64,0,0,0}, {"password","std::string","character varying",64,0,0,0}, {"org_name","std::string","character varying",20,0,0,0}, {"signature","std::string","character varying",50,0,0,0}, {"avatar_id","std::string","character varying",32,0,0,0}, {"id","int32_t","integer",4,1,1,1}, {"salt","std::string","character varying",20,0,0,0}, {"admin","bool","boolean",1,0,0,0} }; const std::string &Users::getColumnName(size_t index) noexcept(false) { assert(index < _metaData.size()); return _metaData[index]._colName; } Users::Users(const Row &r) noexcept { if(!r["user_id"].isNull()) { _userId=std::make_shared(r["user_id"].as()); } if(!r["user_name"].isNull()) { _userName=std::make_shared(r["user_name"].as()); } if(!r["password"].isNull()) { _password=std::make_shared(r["password"].as()); } if(!r["org_name"].isNull()) { _orgName=std::make_shared(r["org_name"].as()); } if(!r["signature"].isNull()) { _signature=std::make_shared(r["signature"].as()); } if(!r["avatar_id"].isNull()) { _avatarId=std::make_shared(r["avatar_id"].as()); } if(!r["id"].isNull()) { _id=std::make_shared(r["id"].as()); } if(!r["salt"].isNull()) { _salt=std::make_shared(r["salt"].as()); } if(!r["admin"].isNull()) { _admin=std::make_shared(r["admin"].as()); } } const std::string & Users::getValueOfUserId(const std::string &defaultValue) const noexcept { if(_userId) return *_userId; return defaultValue; } std::shared_ptr Users::getUserId() const noexcept { return _userId; } void Users::setUserId(const std::string &userId) noexcept { _userId = std::make_shared(userId); _dirtyFlag[0] = true; } void Users::setUserId(std::string &&userId) noexcept { _userId = std::make_shared(std::move(userId)); _dirtyFlag[0] = true; } const std::string & Users::getValueOfUserName(const std::string &defaultValue) const noexcept { if(_userName) return *_userName; return defaultValue; } std::shared_ptr Users::getUserName() const noexcept { return _userName; } void Users::setUserName(const std::string &userName) noexcept { _userName = std::make_shared(userName); _dirtyFlag[1] = true; } void Users::setUserName(std::string &&userName) noexcept { _userName = std::make_shared(std::move(userName)); _dirtyFlag[1] = true; } const std::string & Users::getValueOfPassword(const std::string &defaultValue) const noexcept { if(_password) return *_password; return defaultValue; } std::shared_ptr Users::getPassword() const noexcept { return _password; } void Users::setPassword(const std::string &password) noexcept { _password = std::make_shared(password); _dirtyFlag[2] = true; } void Users::setPassword(std::string &&password) noexcept { _password = std::make_shared(std::move(password)); _dirtyFlag[2] = true; } const std::string & Users::getValueOfOrgName(const std::string &defaultValue) const noexcept { if(_orgName) return *_orgName; return defaultValue; } std::shared_ptr Users::getOrgName() const noexcept { return _orgName; } void Users::setOrgName(const std::string &orgName) noexcept { _orgName = std::make_shared(orgName); _dirtyFlag[3] = true; } void Users::setOrgName(std::string &&orgName) noexcept { _orgName = std::make_shared(std::move(orgName)); _dirtyFlag[3] = true; } const std::string & Users::getValueOfSignature(const std::string &defaultValue) const noexcept { if(_signature) return *_signature; return defaultValue; } std::shared_ptr Users::getSignature() const noexcept { return _signature; } void Users::setSignature(const std::string &signature) noexcept { _signature = std::make_shared(signature); _dirtyFlag[4] = true; } void Users::setSignature(std::string &&signature) noexcept { _signature = std::make_shared(std::move(signature)); _dirtyFlag[4] = true; } const std::string & Users::getValueOfAvatarId(const std::string &defaultValue) const noexcept { if(_avatarId) return *_avatarId; return defaultValue; } std::shared_ptr Users::getAvatarId() const noexcept { return _avatarId; } void Users::setAvatarId(const std::string &avatarId) noexcept { _avatarId = std::make_shared(avatarId); _dirtyFlag[5] = true; } void Users::setAvatarId(std::string &&avatarId) noexcept { _avatarId = std::make_shared(std::move(avatarId)); _dirtyFlag[5] = true; } const int32_t & Users::getValueOfId(const int32_t &defaultValue) const noexcept { if(_id) return *_id; return defaultValue; } std::shared_ptr Users::getId() const noexcept { return _id; } const typename Users::PrimaryKeyType & Users::getPrimaryKey() const { assert(_id); return *_id; } const std::string & Users::getValueOfSalt(const std::string &defaultValue) const noexcept { if(_salt) return *_salt; return defaultValue; } std::shared_ptr Users::getSalt() const noexcept { return _salt; } void Users::setSalt(const std::string &salt) noexcept { _salt = std::make_shared(salt); _dirtyFlag[7] = true; } void Users::setSalt(std::string &&salt) noexcept { _salt = std::make_shared(std::move(salt)); _dirtyFlag[7] = true; } const bool & Users::getValueOfAdmin(const bool &defaultValue) const noexcept { if(_admin) return *_admin; return defaultValue; } std::shared_ptr Users::getAdmin() const noexcept { return _admin; } void Users::setAdmin(const bool &admin) noexcept { _admin = std::make_shared(admin); _dirtyFlag[8] = true; } void Users::updateId(const uint64_t id) { } const std::vector &Users::insertColumns() noexcept { static const std::vector _inCols={ "user_id", "user_name", "password", "org_name", "signature", "avatar_id", "salt", "admin" }; return _inCols; } void Users::outputArgs(drogon::orm::internal::SqlBinder &binder) const { if(getUserId()) { binder << getValueOfUserId(); } else { binder << nullptr; } if(getUserName()) { binder << getValueOfUserName(); } else { binder << nullptr; } if(getPassword()) { binder << getValueOfPassword(); } else { binder << nullptr; } if(getOrgName()) { binder << getValueOfOrgName(); } else { binder << nullptr; } if(getSignature()) { binder << getValueOfSignature(); } else { binder << nullptr; } if(getAvatarId()) { binder << getValueOfAvatarId(); } else { binder << nullptr; } if(getSalt()) { binder << getValueOfSalt(); } else { binder << nullptr; } if(getAdmin()) { binder << getValueOfAdmin(); } else { binder << nullptr; } } const std::vector Users::updateColumns() const { std::vector ret; for(size_t i=0;i