5#include <userver/storages/mysql/impl/io/binder_declarations.hpp>
6#include <userver/storages/mysql/impl/io/params_binder_base.hpp>
12class ParamsBinder
final :
public ParamsBinderBase {
14 explicit ParamsBinder(std::size_t size);
17 ParamsBinder(
const ParamsBinder& other) =
delete;
18 ParamsBinder(ParamsBinder&& other)
noexcept;
20 template <
typename Field>
21 void Bind(std::size_t pos,
const Field& field) {
25 std::size_t GetRowsCount()
const final;
27 template <
typename... Args>
28 static ParamsBinder BindParams(
const Args&... args) {
29 constexpr auto kParamsCount =
sizeof...(Args);
30 ParamsBinder binder{kParamsCount};
32 if constexpr (kParamsCount > 0) {
34 const auto do_bind = [&binder](std::size_t pos,
const auto& arg) {
36 if constexpr (std::is_convertible_v<
decltype(arg),
const char*>) {
37 const auto* const_char_ptr_arg =
static_cast<
const char*>(arg);
39 if (const_char_ptr_arg ==
nullptr) {
41 const std::optional<std::string_view> empty_opt_sw{};
42 binder.Bind(pos, empty_opt_sw);
44 const std::string_view sw{arg};
48 binder.Bind(pos, arg);
52 (..., do_bind(ind++, args));