summaryrefslogtreecommitdiffstats
path: root/src/yaml-extension-functions.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
commit207df6fc406e81bfeebdff7f404bd242ff3f099f (patch)
treea1a796b056909dd0a04ffec163db9363a8757808 /src/yaml-extension-functions.cc
parentReleasing progress-linux version 0.11.2-1~progress7.99u1. (diff)
downloadlnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.tar.xz
lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.zip
Merging upstream version 0.12.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/yaml-extension-functions.cc')
-rw-r--r--src/yaml-extension-functions.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/yaml-extension-functions.cc b/src/yaml-extension-functions.cc
index 0a58652..e19af49 100644
--- a/src/yaml-extension-functions.cc
+++ b/src/yaml-extension-functions.cc
@@ -36,7 +36,7 @@
#include "ryml_all.hpp"
#include "sqlite-extension-func.hh"
#include "vtab_module.hh"
-#include "yajlpp/yajlpp.hh"
+#include "vtab_module_json.hh"
using namespace lnav::roles::literals;
@@ -57,7 +57,7 @@ ryml_error_to_um(const char* msg, size_t len, ryml::Location loc, void* ud)
source_location{src, (int32_t) loc.line}, ""));
}
-static text_auto_buffer
+static json_string
yaml_to_json(string_fragment in)
{
ryml::Callbacks callbacks(&in, nullptr, nullptr, ryml_error_to_um);
@@ -75,7 +75,7 @@ yaml_to_json(string_fragment in)
ryml::substr(buf.in(), buf.size()),
/*error_on_excess*/ true);
- return {std::move(buf)};
+ return json_string{std::move(buf)};
}
int
@@ -87,6 +87,7 @@ yaml_extension_functions(struct FuncDef** basic_funcs,
help_text("yaml_to_json",
"Convert a YAML document to a JSON-encoded string")
.sql_function()
+ .with_prql_path({"yaml", "to_json"})
.with_parameter({"yaml", "The YAML value to convert to JSON."})
.with_tags({"json", "yaml"})
.with_example({