111189 {
111190 vector<string> nodes;
111191 vector<string> edges;
111192
111193 const string node_format = " node_%d_%d[\"`**%s**%s`\"]";
111194
111195 for (
idx_t y = 0; y < root.height; y++) {
111196 for (
idx_t x = 0; x < root.width; x++) {
111197 auto node = root.GetNode(x, y);
111198 if (!node) {
111199 continue;
111200 }
111201
111202
111203 string extra_info;
111204 for (auto &item : node->extra_text) {
111205 auto &key = item.first;
111206 auto &value_raw = item.second;
111207
111208 auto value = QueryProfiler::JSONSanitize(value_raw);
111209
111211 }
111212
111213
111214 auto trimmed_name = node->name;
111216 nodes.push_back(
StringUtil::Format(node_format, x, y, SanitizeMermaidLabel(trimmed_name), extra_info));
111217
111218
111219 for (auto &coord : node->child_positions) {
111220 edges.push_back(
StringUtil::Format(
" node_%d_%d --> node_%d_%d", x, y, coord.x, coord.y));
111221 }
111222 }
111223 }
111224
111225
111226 ss << "flowchart TD\n";
111227
111228
111229 for (auto &node : nodes) {
111230 ss << node << "\n\n";
111231 }
111232
111233
111234 for (auto &edge : edges) {
111235 ss << edge << "\n";
111236 }
111237}
static DUCKDB_API void Trim(string &str)
Remove the whitespace char in the left and right end of the string.
Definition duckdb.cpp:109372
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237