query/demo/work.cpp

69 lines
2.8 KiB
C++

#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 "work/jobs/Job.hpp"
#include "work/jobs/Task.hpp""
#include "work/jobs/Payload.hpp"
#include "work/jobs/IdPayload.hpp"
#include "work/jobs/IdListPayload.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("Administration");
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"); })
.and_then([&schema] { return schema.attach<jobs::Job>("jobs"); })
.and_then([&schema] { return schema.attach<jobs::Payload>("id_payloads"); })
.and_then([&schema] { return schema.attach<jobs::IdPayload>("id_list_payloads"); })
.and_then([&schema] { return schema.attach<jobs::IdListPayload>("payloads"); })
.and_then([&schema] { return schema.attach<jobs::Task>("tasks"); });
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;
}
// registering table 'collection_center' (pk field: 'id')
// registering relation table 'collection_center_users' (first fk field: 'collection_center_id', second fk field: 'user_id')
// registering table 'internal_user_directory' (pk field: 'id')
//