Cast functions for mapping AGE vertex data to Ash resource attributes.
Summary
Functions
Coerces a decoded agtype scalar to its Ash attribute type.
Converts a vertex to a map of resource attributes.
Functions
Coerces a decoded agtype scalar to its Ash attribute type.
Single source of truth for scalar coercion, shared by the vertex-read path
(vertex_to_resource_attrs/3) and the traversal F3 source-key path
(AshAge.ManualRelationships.Traverse). A nil/unknown type returns the
value verbatim (identity), so callers may pass a type map that omits a field.
@spec vertex_to_resource_attrs(AshAge.Type.Vertex.t(), map(), map()) :: map()
Converts a vertex to a map of resource attributes.
- Extracts
vertex.properties - Includes
vertex.idmapped to the resource's primary key - Applies
attribute_mapfor any name remapping - Coerces types based on
attribute_types(e.g., ISO8601 strings -> Date/DateTime)