ArangoXEcto.edge_module

You're seeing just the function edge_module, go back to ArangoXEcto module for more information.
Link to this function

edge_module(from_module, to_module, opts \\ [])

View Source

Specs

edge_module(mod(), mod(), keyword()) :: atom()

Generates a edge schema dynamically

If a collection name is not provided one will be dynamically generated. The naming convention is the names of the two modules is alphabetical order. E.g. User and Post will combine for a collection name of post_user and an edge module name of PostUser. This order is used to prevent duplicates if the from and to orders are switched.

This will create the Ecto Module in the environment dynamically. It will create it under the closest common parent module of the passed modules plus the Edges alias. For example, if the modules were MyApp.Apple.User and MyApp.Apple.Banana.Post then the edge would be created at MyApp.Apple.Edges.PostUser.

Returns the Edge Module name as an atom.

Parameters

  • from_module - Ecto Schema Module for the from part of the edge
  • to_module - Ecto Schema Module for the to part of the edge
  • opts - Options passed for module generation

Options

  • :collection_name - The name of collection to use instead of generating it

Examples

iex> ArangoXEcto.edge_module(MyProject.User, MyProject.Company, [collection_name: "works_for"])
MyProject.WorksFor

iex> ArangoXEcto.edge_module(MyProject.User, MyProject.Company)
MyProject.UsersCompanies