Normalizes an ArcadeDB statement response into rows or a graph.
Removes the serializer's @props field from each row. Retains the
record and graph identity fields @rid, @type, @cat, @in,
and @out.
The HTTP graph serializer returns a graph with vertex and edge lists. Each element keeps its server-defined fields.
An EXPLAIN/PROFILE envelope carries its plan under explainPlan (never result),
so normalize/1 returns {:error, %Arcadic.Error{reason: :use_explain}} for it
rather than a silent empty row set. The plan surface is normalize_plan/1,
consumed by Arcadic.explain/4 and Arcadic.profile/4.
Summary
Functions
Extract result, returning a graph or a list of rows with @props removed.
Extract the EXPLAIN/PROFILE plan envelope: {:ok, %{plan, plan_tree, rows}}.
Types
Functions
@spec normalize(map()) :: {:ok, t()} | {:error, Arcadic.Error.t()}
Extract result, returning a graph or a list of rows with @props removed.
Examples
iex> Arcadic.Result.normalize(%{"result" => [%{"n" => 1, "@props" => "n:1"}]})
{:ok, [%{"n" => 1}]}
Extract the EXPLAIN/PROFILE plan envelope: {:ok, %{plan, plan_tree, rows}}.
Examples
iex> Arcadic.Result.normalize_plan(%{"explain" => "plan", "explainPlan" => %{}, "result" => []})
{:ok, %{rows: [], plan: "plan", plan_tree: %{}}}