6#include <boost/pfr/core.hpp>
8#include <userver/storages/mysql/impl/binder_fwd.hpp>
9#include <userver/storages/mysql/impl/io/binder_declarations.hpp>
10#include <userver/storages/mysql/row_types.hpp>
12USERVER_NAMESPACE_BEGIN
16class ResultBinder
final {
18 explicit ResultBinder(std::size_t size);
21 ResultBinder(
const ResultBinder& other) =
delete;
22 ResultBinder(ResultBinder&& other)
noexcept;
24 template <
typename T,
typename ExtractionTag>
25 OutputBindingsFwd& BindTo(T& row, ExtractionTag) {
26 if constexpr (std::is_same_v<ExtractionTag,
RowTag>) {
27 boost::pfr::for_each_field(
28 row, [&binds = GetBinds()](
auto& field, std::size_t i) {
29 storages::mysql::impl::io::BindOutput(binds, i, field);
32 static_assert(std::is_same_v<ExtractionTag,
FieldTag>);
39 OutputBindingsFwd& GetBinds();
42 OutputBindingsPimpl impl_;