collection_resolver progress
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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,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>
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user