You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Torque.get_many_defaults/3 for 0.1.9
Variant of get_many_nil/2 that takes %{path => default} and returns
%{path => value_or_default}. Saves callers from the awkward two-call
pattern:
paths = Map.keys(defaults)
values = Torque.get_many_nil(doc, paths)
Enum.zip(paths, values)
|> Map.new(fn {p, nil} -> {p, Map.get(defaults, p)}; pv -> pv end)
Now a single call:
Torque.get_many_defaults(doc, %{
"/user/id" => 0,
"/user/name" => "anonymous",
"/created_at" => nil
})
Returns a same-shape map with parsed values, falling back to the
provided defaults for missing/null fields. Same nil/missing
indistinguishability semantics as get_many_nil/2.
Pure-Elixir wrapper around the existing NIF (get_many_nil/2); no
new Rust code, no NIF dispatch overhead beyond the one
get_many_nil call. Has an embedded doctest exercised by the test
suite.
D1's two other plan items resolved on inspection:
- 'aarch64 baseline variant in release matrix' -- aarch64 v8 is
universal across consumer CPUs, no v2 distinction needed. The
matrix already ships aarch64-apple-darwin + aarch64-linux-gnu.
- 'property test for float round-trip precision' -- already
covered by test/property_test.exs (35 properties, 626 lines)
with a json_scalar generator that includes float(-1000..1000),
encoded/decoded through the round-trip suite.
README and mix.exs version both bumped to 0.1.9.