From 92e8900628ed93264486fde36ebae3bc12c407aa Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Fri, 4 Oct 2024 08:19:29 -0600 Subject: [PATCH] Add support for RawJson materialization --- src/materialize.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/materialize.jl b/src/materialize.jl index c89533a..241032c 100644 --- a/src/materialize.jl +++ b/src/materialize.jl @@ -177,3 +177,14 @@ end throw(ArgumentError("cannot lift $x to $T")) end end + +struct RawJson + value::String +end + +function StructUtils.applymake(f::F, ::StructUtils.StructStyle, ::Type{RawJson}, source::LazyValues, tags=(;)) where {F} + buf = getbuf(source) + pos = getpos(source) + endpos = skip(source) + return GC.@preserve buf f(RawJson(unsafe_string(pointer(buf, pos), endpos - pos))) +end