added a bigger real-life demo
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#include "work/admin/CollectionCenter.hpp"
|
||||
#include "work/admin/InternalUserDirectory.hpp"
|
||||
#include "work/admin/LdapGroupSchemaSettings.hpp"
|
||||
#include "work/admin/LdapImportSettings.hpp"
|
||||
#include "work/admin/LdapUserDirectory.hpp"
|
||||
#include "work/admin/LdapUserSchemaSettings.hpp"
|
||||
#include "work/admin/LoginHistory.hpp"
|
||||
#include "work/admin/Scenario.hpp"
|
||||
#include "work/admin/User.hpp"
|
||||
#include "work/admin/UserDirectory.hpp"
|
||||
#include "work/admin/UserSession.hpp"
|
||||
|
||||
#include "matador/object/schema.hpp"
|
||||
|
||||
#include "matador/sql/connection.hpp"
|
||||
|
||||
#include "matador/orm/session.hpp"
|
||||
|
||||
using namespace matador;
|
||||
using namespace work::models;
|
||||
|
||||
int main() {
|
||||
object::schema schema;
|
||||
|
||||
auto result = schema.attach<admin::CollectionCenter>("collection_center")
|
||||
.and_then([&schema] { return schema.attach<admin::InternalUserDirectory>("internal_user_directory"); })
|
||||
.and_then([&schema] { return schema.attach<admin::LdapGroupSchemaSettings>("ldap_group_schema_settings"); })
|
||||
.and_then([&schema] { return schema.attach<admin::LdapImportSettings>("ldap_import_settings"); })
|
||||
.and_then([&schema] { return schema.attach<admin::LdapUserDirectory>("ldap_user_directory"); } )
|
||||
.and_then([&schema] { return schema.attach<admin::LdapUserSchemaSettings>("ldap_user_schema_settings"); })
|
||||
.and_then([&schema] { return schema.attach<admin::LoginHistory>("login_history"); })
|
||||
.and_then([&schema] { return schema.attach<admin::Scenario>("scenario"); })
|
||||
.and_then([&schema] { return schema.attach<admin::User>("user"); })
|
||||
.and_then([&schema] { return schema.attach<admin::UserDirectory>("user_directory"); })
|
||||
.and_then([&schema] { return schema.attach<admin::UserSession>("user_session"); });
|
||||
|
||||
if (!result.is_ok()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const std::string dns{"sqlite://demo.db"};
|
||||
sql::connection c(dns);
|
||||
|
||||
result = c.open();
|
||||
|
||||
// orm::session s()
|
||||
if (!result.is_ok()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user