Skip to content

Commit

Permalink
Add support for RawJson materialization
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Oct 4, 2024
1 parent b575918 commit 92e8900
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/materialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 92e8900

Please sign in to comment.