AshNeo4j.Resource.Info (AshNeo4j v0.5.1)

Copy Markdown View Source

Resource information for AshNeo4j.DataLayer

Summary

Functions

Returns the Ash.Type of the attribute from the name

Converts attributes to node properties

Converts an attribute name to a node property name string, translating if necessary

Returns whether the relationship is exclusive on the destination resource, given a source resource and source relationship name

The domain label is the PascalCase short name of the domain's Elixir Module name. It is used only on create.

The match label used for read, update, and destroy operations. This is the value of label in the neo4j do block — which may come from a fragment (e.g. :Instance from BaseInstance). Defaults to the PascalCase short name of the resource module.

Returns the full list of labels written to the node on CREATE. Always starts with the domain label, followed by the module label, then any additional base type labels from fragments. For example, DiffoExample.Access.Shelf (using BaseInstance) returns [:Access, :Shelf, :Instance].

Returns the complete graph mapping for a resource as a %AshNeo4j.ResourceMapping{} struct. This is the single source of truth for how an Ash resource maps to the Neo4j graph.

The label derived from the resource module's own short name (e.g. :Shelf for MyApp.Access.Shelf). Always set regardless of any fragment label override. Use this when you need to identify the specific resource type rather than its base type.

Returns a node_relationship that matches the relationship name

Returns a node_relationship that matches the edge label, edge direction and destination label

Returns the list of node relationships which block resource deletion, given the source resource The node relationships are tuples of {edge_label, edge_direction, destination_label} These include explicit guard relationships.

Returns the effective relate of the resource, merging DSL and defaults

Returns the relationship from the source attribute, if any

Returns a matching Ash.Resource.Info relationship given edge label, edge direction and destination node label

Returns the relationship attributes for the resource.

Returns the reverse node relationship given resource and relationship name

Returns the reverse relationship given resource and relationship name

Returns whether the relationship is exclusive on the source resource

Returns the list of attribute translations for the resource.

Functions

attribute_type(resource, ash_query_ref)

@spec attribute_type(Ash.Resource.t(), atom()) :: Ash.Type.t() | nil
@spec attribute_type(Ash.Resource.t(), atom()) :: Ash.Type.t() | nil

Returns the Ash.Type of the attribute from the name

convert_to_properties(resource, attributes)

@spec convert_to_properties(Ash.Resource.t(), map()) :: map()

Converts attributes to node properties

convert_to_property_name(resource, ash_query_ref)

@spec convert_to_property_name(Ash.Resource.t(), Ash.Query.Ref.t()) ::
  String.t() | nil
@spec convert_to_property_name(Ash.Resource.t(), atom()) :: String.t() | nil

Converts an attribute name to a node property name string, translating if necessary

destination_exclusive?(resource, name)

@spec destination_exclusive?(Ash.Resource.t(), atom()) :: boolean()

Returns whether the relationship is exclusive on the destination resource, given a source resource and source relationship name

domain_label(resource)

@spec domain_label(Ash.Resource.t()) :: atom() | nil

The domain label is the PascalCase short name of the domain's Elixir Module name. It is used only on create.

label(resource)

@spec label(Ash.Resource.t()) :: atom() | nil

The match label used for read, update, and destroy operations. This is the value of label in the neo4j do block — which may come from a fragment (e.g. :Instance from BaseInstance). Defaults to the PascalCase short name of the resource module.

labels(resource)

@spec labels(Ash.Resource.t()) :: [atom()] | nil

Returns the full list of labels written to the node on CREATE. Always starts with the domain label, followed by the module label, then any additional base type labels from fragments. For example, DiffoExample.Access.Shelf (using BaseInstance) returns [:Access, :Shelf, :Instance].

mapping(resource)

Returns the complete graph mapping for a resource as a %AshNeo4j.ResourceMapping{} struct. This is the single source of truth for how an Ash resource maps to the Neo4j graph.

module_label(resource)

@spec module_label(Ash.Resource.t()) :: atom() | nil

The label derived from the resource module's own short name (e.g. :Shelf for MyApp.Access.Shelf). Always set regardless of any fragment label override. Use this when you need to identify the specific resource type rather than its base type.

node_relationship(resource, name)

@spec node_relationship(Ash.Resource.t(), atom() | String.t()) :: tuple() | nil

Returns a node_relationship that matches the relationship name

node_relationship(resource, edge_label, edge_direction, destination_label)

@spec node_relationship(Ash.Resource.t(), atom(), atom(), atom()) :: tuple() | nil
@spec node_relationship(Ash.Resource.t(), atom(), atom(), [atom()]) :: tuple() | nil

Returns a node_relationship that matches the edge label, edge direction and destination label

preserve_node_relationships(resource)

@spec preserve_node_relationships(Ash.Resource.t()) :: [tuple()]

Returns the list of node relationships which block resource deletion, given the source resource The node relationships are tuples of {edge_label, edge_direction, destination_label} These include explicit guard relationships.

relate(resource)

@spec relate(Ash.Resource.t()) :: [tuple()] | nil

Returns the effective relate of the resource, merging DSL and defaults

relationship(resource, source_attribute)

@spec relationship(Ash.Resource.t(), atom() | String.t()) :: tuple() | nil

Returns the relationship from the source attribute, if any

relationship(resource, edge_label, edge_direction, destination_label)

@spec relationship(Ash.Resource.t(), atom(), atom(), atom()) :: struct() | nil
@spec relationship(Ash.Resource.t(), atom(), atom(), [atom()]) :: struct() | nil

Returns a matching Ash.Resource.Info relationship given edge label, edge direction and destination node label

relationship_attributes(resource)

@spec relationship_attributes(Ash.Resource.t()) :: keyword() | nil

Returns the relationship attributes for the resource.

reverse_node_relationship(resource, name)

@spec reverse_node_relationship(Ash.Resource.t(), atom()) :: tuple() | nil

Returns the reverse node relationship given resource and relationship name

reverse_relationship(resource, name)

@spec reverse_relationship(Ash.Resource.t(), atom()) :: tuple() | nil

Returns the reverse relationship given resource and relationship name

source_exclusive?(resource, name)

@spec source_exclusive?(Ash.Resource.t(), atom()) :: boolean()

Returns whether the relationship is exclusive on the source resource

translations(resource)

@spec translations(Ash.Resource.t()) :: keyword() | nil

Returns the list of attribute translations for the resource.