AshAge.Type.Agtype (AshAge v1.0.1)

Copy Markdown View Source

AGType decoder for PostgreSQL AGE graph data.

AGE returns text in formats like:

{"id": 844424930131969, "label": "Person", "properties": {"name": "Usman"}}::vertex
{"id": N, "label": "L", "end_id": N, "start_id": N, "properties": {...}}::edge
[{...}::vertex, {...}::edge, {...}::vertex, ...]::path

For vertices and edges this module strips the type suffix, JSON-decodes the body, and maps to the appropriate struct. A ::path body is NOT plain JSON: each element is itself a fully tagged ::vertex/::edge agtype, so the path decoder splits the array at top-level commas and recursively decodes each element, then partitions the results into vertices and edges (order preserved).

Summary

Functions

Decodes an agtype string into an Elixir struct.

Functions

decode(agtype_string)

Decodes an agtype string into an Elixir struct.

Returns a %Vertex{}, %Edge{}, %Path{}, or a scalar value.