added observer to repository and updated tests

This commit is contained in:
Sascha Kühl
2025-12-18 16:13:36 +01:00
parent 6307850721
commit 5e2d2ddde5
11 changed files with 286 additions and 66 deletions
+6 -6
View File
@@ -33,14 +33,14 @@ public:
explicit schema(sql::connection_pool &pool);
schema(sql::connection_pool &pool, const std::string &name);
template<typename Type>
[[nodiscard]] utils::result<void, utils::error> attach(const std::string &name, const std::string &parent = "") {
return repo_.attach<Type>(name, parent);
template<typename Type, template <typename> class ObserverType>
[[nodiscard]] utils::result<void, utils::error> attach(const std::string &name, const std::string &parent = "", std::initializer_list<ObserverType<Type>*> observer = {}) {
return repo_.attach<Type>(name, parent, observer);
}
template<typename Type, typename SuperType>
[[nodiscard]] utils::result<void, utils::error> attach(const std::string &name) {
return repo_.attach<Type, SuperType>(name);
template<typename Type, typename SuperType, template <typename> class ObserverType>
[[nodiscard]] utils::result<void, utils::error> attach(const std::string &name, std::initializer_list<ObserverType<Type>*> observer = {}) {
return repo_.attach<Type, SuperType>(name, observer);
}
[[nodiscard]] utils::result<void, utils::error> create() const;