3#include <boost/pfr/core.hpp>
5#include <userver/storages/mysql/impl/io/insert_binder.hpp>
6#include <userver/storages/mysql/impl/io/params_binder.hpp>
12class BindHelper
final {
14 template <
typename... Args>
15 static io::ParamsBinder BindParams(
const Args&... args) {
16 return io::ParamsBinder::BindParams(args...);
20 static io::ParamsBinder BindRowAsParams(
const T& row) {
22 using Row = std::decay_t<T>;
23 static_assert(boost::pfr::tuple_size_v<Row> != 0,
24 "Row to insert has zero columns");
27 [](
const auto&... args) {
28 return impl::io::ParamsBinder::BindParams(args...);
30 boost::pfr::structure_tie(row));
33 template <
typename Container>
34 static io::InsertBinder<Container> BindContainerAsParams(
35 const Container& rows) {
36 return io::InsertBinder{rows};
39 template <
typename MapTo,
typename Container>
40 static io::InsertBinder<Container, MapTo> BindContainerAsParamsMapped(
41 const Container& rows) {
42 return io::InsertBinder<Container, MapTo>{rows};