collection_resolver progress

This commit is contained in:
Sascha Kühl
2026-01-28 16:09:54 +01:00
parent 6205ae81c9
commit 602b77e67b
31 changed files with 122 additions and 79 deletions
+5 -2
View File
@@ -588,11 +588,14 @@ TEST_CASE_METHOD(QueryFixture, "Test load entity with eager has many relation",
}
TEST_CASE_METHOD(QueryFixture, "Test load entity with lazy has many relation", "[query][has_many][lazy]") {
auto result = repo.attach<author>("authors")
.and_then( [this] { return repo.attach<book>("books"); } )
// auto result = repo.attach<author>("authors")
// .and_then( [this] { return repo.attach<book>("books"); } )
auto result = repo.attach<book>("books")
.and_then( [this] { return repo.attach<author>("authors"); } )
.and_then([this] {
return repo.create(db);
} );
REQUIRE(result.is_ok());
repo.initialize_executor(db);
+2 -1
View File
@@ -4,6 +4,7 @@
#include "matador/utils/access.hpp"
#include "matador/object/object_ptr.hpp"
#include "matador/object/collection.hpp"
#include <string>
#include <vector>
@@ -25,7 +26,7 @@ struct author {
std::string date_of_birth;
unsigned short year_of_birth{};
bool distinguished{false};
std::vector<object::object_ptr<book> > books;
object::collection<object::object_ptr<book> > books;
template<typename Operator>
void process(Operator &op) {
+2 -1
View File
@@ -2,6 +2,7 @@
#define DEPARTMENT_EMPLOYEE_HPP
#include "matador/object/object_ptr.hpp"
#include "matador/object/collection.hpp"
#include <string>
#include <vector>
@@ -16,7 +17,7 @@ struct department {
: id(id), name(std::move(name)) {}
unsigned int id{};
std::string name;
std::vector<object::object_ptr<employee>> employees{};
object::collection<object::object_ptr<employee>> employees{};
// object::object_ptr<employee> manager;
template<typename Operator>
+1 -1
View File
@@ -51,7 +51,7 @@ utils::result<size_t, utils::error> test_connection::execute(const std::string &
utils::result<std::unique_ptr<sql::query_result_impl>, utils::error> test_connection::fetch(const sql::query_context &context) {
return utils::ok(std::make_unique<sql::query_result_impl>(std::make_unique<test_result_reader>(),
context.prototype,
context.resolver_factory,
context.resolver,
context.prototype.size()));
}
+1 -1
View File
@@ -21,7 +21,7 @@ utils::result<size_t, utils::error> test_statement::execute(const sql::parameter
utils::result<std::unique_ptr<sql::query_result_impl>, utils::error> test_statement::fetch(const sql::parameter_binder &/*bindings*/) {
return utils::ok(std::make_unique<sql::query_result_impl>(std::make_unique<test_result_reader>(),
query_.prototype,
query_.resolver_factory,
query_.resolver,
query_.prototype.size()));
}