12#include <userver/compiler/select.hpp>
13#include <userver/formats/bson/document.hpp>
14#include <userver/formats/bson/value.hpp>
15#include <userver/formats/json_fwd.hpp>
16#include <userver/logging/log_helper_fwd.hpp>
17#include <userver/utils/fast_pimpl.hpp>
18#include <userver/utils/fmt_compat.hpp>
20USERVER_NAMESPACE_BEGIN
22namespace formats::parse {
24formats::json::Value Convert(
const formats::
bson::
Value& bson, formats::parse::To<formats::json::Value>);
25formats::
bson::
Value Convert(
const formats::json::Value& json, formats::parse::To<formats::
bson::
Value>);
29namespace formats::
bson {
80 explicit JsonString(impl::JsonStringImpl&&);
93 const char* Data()
const;
97 static constexpr std::size_t kSize =
98 compiler::SelectSize()
101 static constexpr std::size_t kAlignment =
alignof(
void*);
102 utils::FastPimpl<impl::JsonStringImpl, kSize, kAlignment, utils::kStrictMatch> impl_;
105std::ostream& operator<<(std::ostream&,
const JsonString&);
107logging::LogHelper& operator<<(logging::LogHelper&,
const JsonString&);
110logging::LogHelper& operator<<(logging::LogHelper&,
const Document&);
117struct fmt::formatter<USERVER_NAMESPACE::formats::
bson::
JsonString> :
public fmt::formatter<std::string_view> {
118 template <
typename FormatContext>
119 auto format(
const USERVER_NAMESPACE::formats::
bson::
JsonString& json, FormatContext& ctx) USERVER_FMT_CONST {
120 return fmt::formatter<std::string_view>::format(json
.GetView(), ctx);
126struct fmt::formatter<USERVER_NAMESPACE::formats::
bson::
Document> :
public fmt::formatter<std::string_view> {
127 template <
typename FormatContext>
128 auto format(
const USERVER_NAMESPACE::formats::
bson::
Document& bson, FormatContext& ctx) USERVER_FMT_CONST {
129 return fmt::formatter<