More fixes

This commit is contained in:
Robert Schulze 2023-04-27 09:33:52 +00:00
parent 739bfc9b8d
commit 096667be45
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
3 changed files with 32 additions and 24 deletions

View File

@ -0,0 +1,30 @@
#include <Common/Documentation.h>
namespace DB
{
std::string Documentation::examplesAsString() const
{
std::string res;
for (const auto & [example_name, example_query] : examples)
{
res += example_name + ":\n\n";
res += "```sql\n";
res += example_query + "\n";
res += "```\n";
}
return res;
}
std::string Documentation::categoriesAsString() const
{
if (categories.empty())
return "";
std::string res = categories[0];
for (size_t i = 1; i < categories.size(); ++i)
res += ", " + categories[i];
return res;
}
}

View File

@ -78,29 +78,8 @@ struct Documentation
/// TODO: Please remove this constructor. Documentation should always be non-empty.
Documentation() = default;
std::string examplesAsString() const
{
std::string res;
for (const auto & [example_name, example_query] : examples)
{
res += example_name + ":\n\n";
res += "```sql\n";
res += example_query + "\n";
res += "```\n";
}
return res;
}
std::string categoriesAsString() const
{
if (categories.empty())
return "";
std::string res = categories[0];
for (size_t i = 1; i < categories.size(); ++i)
res += ", " + categories[i];
return res;
}
std::string examplesAsString() const;
std::string categoriesAsString() const;
};
}

View File

@ -40,7 +40,6 @@ namespace
{
res_columns[2]->insert(false);
res_columns[3]->insertDefault();
res_columns[7]->insert(false);
}
else
{