#pragma once #include // TODO(arkady-e1ppa): Eliminate. #include namespace NYT { //////////////////////////////////////////////////////////////////////////////// namespace NToAttributeValueImpl { struct TFn : public TTagInvokeCpoBase { }; } // namespace NToAttributeValueImpl //////////////////////////////////////////////////////////////////////////////// inline constexpr NToAttributeValueImpl::TFn ToAttributeValue = {}; //////////////////////////////////////////////////////////////////////////////// template concept CConvertibleToAttributeValue = CTagInvocableS< TTagInvokeTag, NYson::TYsonString(const T&)>; //////////////////////////////////////////////////////////////////////////////// struct TErrorAttribute { // NB(arkady-e1ppa): Switch to std::string is quite possible // however it requires patching IAttributeDictionary or // switching it to the std::string first for interop reasons. // Do that later. using TKey = TString; // TODO(arkady-e1ppa): Use ConvertToYsonString(value, Format::Text) // here for complex values. Write manual implementations as ToString // for primitive types (e.g. integral types, guid, string, time). using TValue = NYson::TYsonString; template TErrorAttribute(const TKey& key, const T& value) : Key(key) , Value(NYT::ToAttributeValue(value)) { } TKey Key; TValue Value; }; //////////////////////////////////////////////////////////////////////////////// } // namespace NYT