renamed schema to repository

This commit is contained in:
Sascha Kühl
2025-08-28 16:12:26 +02:00
parent cce7f2c099
commit 3ae2b003aa
45 changed files with 823 additions and 823 deletions
+38 -38
View File
@@ -20,12 +20,12 @@ using namespace matador::sql;
using namespace matador::test;
TEST_CASE_METHOD(QueryFixture, "Create table with foreign key relation", "[query][foreign][relation]") {
auto result = schema.attach<airplane>("airplane")
.and_then( [this] { return schema.attach<flight>("flight");} );
auto result = repo.attach<airplane>("airplane")
.and_then( [this] { return repo.attach<flight>("flight");} );
REQUIRE(result.is_ok());
auto res = query::create()
.table<airplane>("airplane", schema)
.table<airplane>("airplane", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -34,7 +34,7 @@ TEST_CASE_METHOD(QueryFixture, "Create table with foreign key relation", "[query
tables_to_drop.emplace("airplane");
res = query::create()
.table<flight>("flight", schema)
.table<flight>("flight", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -44,9 +44,9 @@ TEST_CASE_METHOD(QueryFixture, "Create table with foreign key relation", "[query
}
TEST_CASE_METHOD(QueryFixture, "Execute select statement with where clause", "[query][where]") {
REQUIRE(schema.attach<person>("person"));
REQUIRE(repo.attach<person>("person"));
auto res = query::create()
.table<person>("person", schema)
.table<person>("person", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -58,14 +58,14 @@ TEST_CASE_METHOD(QueryFixture, "Execute select statement with where clause", "[q
george.image.emplace_back(37);
res = query::insert()
.into("person", column_generator::generate<person>(schema, true))
.into("person", column_generator::generate<person>(repo, true))
.values(george)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 1);
// fetch person as record
auto result_record = query::select(column_generator::generate<person>(schema, true))
auto result_record = query::select(column_generator::generate<person>(repo, true))
.from("person")
.where("id"_col == 7)
.fetch_all(db);
@@ -85,7 +85,7 @@ TEST_CASE_METHOD(QueryFixture, "Execute select statement with where clause", "[q
}
// fetch person as person
auto result_person = query::select(column_generator::generate<person>(schema, true))
auto result_person = query::select(column_generator::generate<person>(repo, true))
.from("person")
.where("id"_col == 7)
.fetch_all<person>(db);
@@ -141,12 +141,12 @@ TEST_CASE_METHOD(QueryFixture, "Execute insert statement", "[query][insert]") {
}
TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key", "[query][foreign]") {
auto result = schema.attach<airplane>("airplane")
.and_then( [this] { return schema.attach<flight>("flight");} );
auto result = repo.attach<airplane>("airplane")
.and_then( [this] { return repo.attach<flight>("flight");} );
REQUIRE(result.is_ok());
auto res = query::create()
.table<airplane>("airplane", schema)
.table<airplane>("airplane", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -155,7 +155,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key", "[query][for
tables_to_drop.emplace("airplane");
res = query::create()
.table<flight>("flight", schema)
.table<flight>("flight", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -171,7 +171,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key", "[query][for
for (const auto &plane: planes) {
res = query::insert()
.into("airplane", column_generator::generate<airplane>(schema, true))
.into("airplane", column_generator::generate<airplane>(repo, true))
.values(*plane)
.execute(db);
REQUIRE(res.is_ok());
@@ -187,13 +187,13 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key", "[query][for
flight f4711{4, planes.at(1), "hans"};
res = query::insert()
.into("flight", column_generator::generate<flight>(schema, true))
.into("flight", column_generator::generate<flight>(repo, true))
.values(f4711)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 1);
auto f = query::select(column_generator::generate<flight>(schema, true))
auto f = query::select(column_generator::generate<flight>(repo, true))
.from("flight")
.fetch_one(db);
REQUIRE(f.is_ok());
@@ -204,12 +204,12 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key", "[query][for
}
TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and join_left", "[query][foreign][join_left]") {
auto result = schema.attach<airplane>("airplane")
.and_then( [this] { return schema.attach<flight>("flight");} );
auto result = repo.attach<airplane>("airplane")
.and_then( [this] { return repo.attach<flight>("flight");} );
REQUIRE(result.is_ok());
auto res = query::create()
.table<airplane>("airplane", schema)
.table<airplane>("airplane", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -218,7 +218,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and join_left"
tables_to_drop.emplace("airplane");
res = query::create()
.table<flight>("flight", schema)
.table<flight>("flight", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -234,7 +234,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and join_left"
for (const auto &plane: planes) {
res = query::insert()
.into("airplane", column_generator::generate<airplane>(schema, true))
.into("airplane", column_generator::generate<airplane>(repo, true))
.values(*plane)
.execute(db);
REQUIRE(res.is_ok());
@@ -262,7 +262,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and join_left"
REQUIRE(*res == 1);
}
auto f = query::select(column_generator::generate<flight>(schema, true))
auto f = query::select(column_generator::generate<flight>(repo, true))
.from("flight")
.fetch_one(db);
REQUIRE(f.is_ok());
@@ -294,12 +294,12 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and join_left"
}
TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and for single entity", "[query][join_left][find]") {
auto result = schema.attach<airplane>("airplane")
.and_then( [this] { return schema.attach<flight>("flight");} );
auto result = repo.attach<airplane>("airplane")
.and_then( [this] { return repo.attach<flight>("flight");} );
REQUIRE(result.is_ok());
auto res = query::create()
.table<airplane>("airplane", schema)
.table<airplane>("airplane", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -308,7 +308,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and for single
tables_to_drop.emplace("airplane");
res = query::create()
.table<flight>("flight", schema)
.table<flight>("flight", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -324,7 +324,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and for single
for (const auto &plane: planes) {
res = query::insert()
.into("airplane", column_generator::generate<airplane>(schema, true))
.into("airplane", column_generator::generate<airplane>(repo, true))
.values(*plane)
.execute(db);
REQUIRE(res.is_ok());
@@ -347,14 +347,14 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and for single
for (const auto &f: flights) {
res = query::insert()
.into("flight", column_generator::generate<flight>(schema, true))
.into("flight", column_generator::generate<flight>(repo, true))
.values(*f)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 1);
}
auto f = query::select(column_generator::generate<flight>(schema, true))
auto f = query::select(column_generator::generate<flight>(repo, true))
.from("flight")
.fetch_one(db);
REQUIRE(f.is_ok());
@@ -384,12 +384,12 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and for single
}
TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship", "[query][join][many_to_many]") {
auto result = schema.attach<recipe>("recipes")
.and_then( [this] { return schema.attach<ingredient>("ingredients"); } )
.and_then( [this] { return schema.attach<recipe_ingredient>("recipe_ingredients"); } );
auto result = repo.attach<recipe>("recipes")
.and_then( [this] { return repo.attach<ingredient>("ingredients"); } )
.and_then( [this] { return repo.attach<recipe_ingredient>("recipe_ingredients"); } );
auto res = query::create()
.table<recipe>("recipes", schema)
.table<recipe>("recipes", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -398,7 +398,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship"
tables_to_drop.emplace("recipes");
res = query::create()
.table<ingredient>("ingredients", schema)
.table<ingredient>("ingredients", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -407,7 +407,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship"
tables_to_drop.emplace("ingredients");
res = query::create()
.table<recipe_ingredient>("recipe_ingredients", schema)
.table<recipe_ingredient>("recipe_ingredients", repo)
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(*res == 0);
@@ -427,7 +427,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship"
for (const auto &i: ingredients) {
res = query::insert()
.into("ingredients", column_generator::generate<ingredient>(schema, true))
.into("ingredients", column_generator::generate<ingredient>(repo, true))
.values(i)
.execute(db);
REQUIRE(res.is_ok());
@@ -442,7 +442,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship"
for (const auto &r: recipes) {
res = query::insert()
.into("recipes", column_generator::generate<recipe>(schema, true))
.into("recipes", column_generator::generate<recipe>(repo, true))
.values(r)
.execute(db);
REQUIRE(res.is_ok());
@@ -462,7 +462,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship"
for (const auto &ri: recipe_ingredients) {
res = query::insert()
.into("recipe_ingredients", column_generator::generate<recipe_ingredient>(schema, true))
.into("recipe_ingredients", column_generator::generate<recipe_ingredient>(repo, true))
.values({ri.first, ri.second})
.execute(db);
REQUIRE(res.is_ok());