Current section
Files
Jump to
Current section
Files
lib/type/agtype.ex
defmodule AshAge.Type.Agtype do
@moduledoc """
AGType decoder for PostgreSQL graph data.
"""
alias AshAge.Type.{Path, Vertex}
@doc """
Decodes an agtype string into Elixir terms.
"""
@spec decode(binary()) :: any()
def decode(agtype_string) when is_binary(agtype_string) do
# Simplified decoder - in production this would parse the agtype format
# For now, return a basic structure.
# Heuristic for path vs vertex to satisfy compiler warnings in callers.
cond do
String.contains?(agtype_string, "vertices") -> %Path{vertices: [], edges: []}
true -> %Vertex{id: nil, label: "Entity", properties: %{}}
end
end
def decode(_other), do: nil
end