View Source ArangoXEcto.Association.Graph (ArangoX Ecto v2.0.0)
The association struct for a graph
association.
This is based off of the many_to_many
relationship but modified to suit
graph relations. This is uses graph traversal queries instead of the standard
SQL format queries.
This allows for multiple related schemas through the same edge. E.g.
graph :friends, [Person, Pet], edge: Friends, on_replace: :delete
Use the fields on the schema to identify which schema to use. If any of the fields in the list exists then it will use the key as the module.
graph :friends, %{
Person => [:first_name],
Pet => [:name]
},
edge: Friends
The available fields are:
cardinality
- The association cardinality, always:many
field
- The name of the association field on the schemaowner
- The schema where the association was definedowner_key
- The key on theowner
schema used for the associationrelated
- The schema that is associatedrelated_key
- The key on therelated
schema used for the associationqueryables
- The real query to use for querying associationdefaults
- default fields used when building the associationrelationship
- The relationship to the specified schema, default:parent
on_replace
- The action taken on associations when schema is replaced
Summary
Types
@type t() :: %ArangoXEcto.Association.Graph{ cardinality: :many, direction: :outbound | :inbound, edge: module(), field: atom(), mapping: map(), on_cast: nil | (... -> any()), on_delete: nil | (... -> any()), on_replace: atom(), ordered: false, owner: atom(), owner_key: atom(), preload_order: list(), queryables: [atom()], related: [atom()], relationship: :child, unique: false, where: Keyword.t() }