Compare commits

..

2 Commits

Author SHA1 Message Date
sascha 73bd6f641c delete has many to many progress 2026-05-27 16:10:26 +02:00
sascha 98d58d8e60 small fixes 2026-05-27 16:10:03 +02:00
3 changed files with 12 additions and 21 deletions

View File

@ -113,8 +113,8 @@ class null_observer : public observer<Type> {
public:
template < class OtherType >
explicit null_observer(const null_observer<OtherType> *) {}
void on_attach(repository_node &, Type &) override {}
void on_detach(repository_node &, Type &) override {}
void on_attach(const repository_node &, const Type &) const override {}
void on_detach(const repository_node &, const Type &) const override {}
void on_insert(Type &) override {}
void on_update(Type &) override {}
void on_delete(Type &) override {}

View File

@ -88,9 +88,11 @@ struct pk_field_locator {
desc.kind = pk_kind::uuid;
desc.is_known_at = [](void *obj, const std::size_t off) -> bool {
auto *p = reinterpret_cast<uuid16 *>(static_cast<std::uint8_t *>(obj) + off);
const auto *p = reinterpret_cast<uuid16 *>(static_cast<std::uint8_t *>(obj) + off);
// “unknown” = all zeros
for (auto b: *p) { if (b != 0) return true; }
for (const auto b: *p) {
if (b != 0) return true;
}
return false;
};

View File

@ -22,23 +22,6 @@ void validate_author_state(const object_ptr<AuthorType>& ptr, object_state expec
}
}
namespace matador::utils {
template < typename ValueType >
std::ostream& operator<<(std::ostream& os, const result<ValueType, error>& value) {
if (value) {
return os;
}
return os << "Error: " << value.err();
}
std::ostream& operator<<(std::ostream& os, const result<void, error>& value) {
if (value) {
return os;
}
return os << "Error: " << value.err();
}
}
TEST_CASE_METHOD(SessionFixture, "Test delete object with has many to many relation", "[session][delete][has_many_to_many]") {
auto result = schema.attach<recipe_sequence>("recipes")
.and_then( [this] { return schema.attach<ingredient_sequence>("ingredients"); } )
@ -77,4 +60,10 @@ TEST_CASE_METHOD(SessionFixture, "Test delete object with has many to many relat
const auto ing_result = ses.find<ingredient_sequence>(ingredients[0]->id);
REQUIRE(ing_result.is_ok());
REQUIRE(ing_result.value()->recipes.size() == 2);
auto del_res = ses.remove(recipes[0]);
REQUIRE(del_res);
recipe_result = ses.find<recipe_sequence>(1);
REQUIRE_FALSE(recipe_result);
}