added pk information to class object

This commit is contained in:
Sascha Kühl
2025-11-25 08:54:58 +01:00
parent ede5a8c636
commit ab7a2db869
6 changed files with 52 additions and 17 deletions
+10 -9
View File
@@ -7,14 +7,15 @@
#include "../test/models/book.hpp"
TEST_CASE("Generate object from type", "[object][generate]") {
using namespace matador;
object::repository repo;
auto result = repo.attach<test::author>("authors");
REQUIRE(result);
using namespace matador;
object::repository repo;
auto result = repo.attach<test::author>("authors");
REQUIRE(result);
const auto obj = object::object::generate<test::book>(repo, "books");
REQUIRE(obj->name() == "books");
REQUIRE(obj->alias().empty());
REQUIRE(obj->attributes().size() == 4);
REQUIRE(obj->constraints().size() == 2);
const auto obj = object::object::generate<test::book>(repo, "books");
REQUIRE(obj->name() == "books");
REQUIRE(obj->alias().empty());
REQUIRE(obj->attributes().size() == 4);
REQUIRE(obj->constraints().size() == 2);
REQUIRE(obj->has_primary_key());
}