10#include <userver/utils/fmt_compat.hpp>
11#include <userver/utils/strong_typedef.hpp>
13#include <userver/storages/clickhouse/io/impl/escape.hpp>
15USERVER_NAMESPACE_BEGIN
35 using Name = USERVER_NAMESPACE::utils::StrongTypedef<
struct NameTag, std::string>;
37 Query(
const char* text, std::optional<Name> = std::nullopt);
38 Query(std::string text, std::optional<Name> = std::nullopt);
40 const std::string& QueryText()
const&;
42 const std::optional<Name>& QueryName()
const&;
45 friend class QueryTester;
46 friend class impl::Pool;
49 template <
typename... Args>
50 Query WithArgs(
const Args&... args)
const {
53 return Query{fmt::format(fmt::runtime(text_), io::impl::Escape(args)...), name_};
56 void FillSpanTags(
tracing::Span&)
const;
59 std::optional<Name> name_;