query/include/matador/sql/internal/collection_resolver_produce...

37 lines
1.1 KiB
C++

#ifndef MATADOR_COLLECTION_RESOLVER_PRODUCER_HPP
#define MATADOR_COLLECTION_RESOLVER_PRODUCER_HPP
#include "matador/object/abstract_collection_resolver.hpp"
#include "matador/sql/query_context.hpp"
#include "matador/utils/error.hpp"
#include "matador/utils/result.hpp"
#include <memory>
namespace matador::sql {
class dialect;
class statement;
class resolver_service;
class collection_resolver_producer {
public:
virtual ~collection_resolver_producer() = default;
virtual utils::result<query_context, utils::error> build_query(const dialect& d) = 0;
virtual std::shared_ptr<object::abstract_collection_resolver> produce(statement&& stmt, const resolver_service& rs) = 0;
[[nodiscard]] const std::type_index& root_type() const;
[[nodiscard]] const std::type_index& type() const;
[[nodiscard]] const std::string& collection_name() const;
protected:
explicit collection_resolver_producer(const std::type_index &root_type, const std::type_index &type, std::string collection_name);
private:
std::type_index root_type_;
std::type_index type_;
std::string collection_name_;
};
}
#endif // MATADOR_COLLECTION_RESOLVER_PRODUCER_HPP