EctoNeo4j v0.6.6 Ecto.Adapters.Neo4j.Schema View Source

Helps to describe graph schema.

-> Adds :uuid as default primary key

-> Provides 2 helpers to manage relationship:

  • outgoing_relationship
  • incoming relationship

Link to this section Summary

Link to this section Functions

Link to this function

build_foreign_key(name) View Source
build_foreign_key(atom()) :: atom()

Link to this macro

incoming_relationship(name, queryable, opts \\ []) View Source (macro)

Decribe a incoming relationship for current Ecto.Schema to given Ecto.Schema

IMPORTANT:

  • association name has to be formated as : [relationship_name]_[child_schema_name]
  • an outgoing_relationship with the exact same name has to be added in the parent schema.

Example

# Describes a relationship: (User)-[:WROTE]->(Post)
schema "Post" do
  incoming_relationship :wrote_post, EctoNeo4j.Integration.User
end

Options

:unique: set to true, the association will be a has_one. Set to false, association will be has_many. [Default: false]

Link to this macro

outgoing_relationship(name, queryable, opts \\ []) View Source (macro)

Decribe a outgoing relationship for current Ecto.Schema to given Ecto.Schema

IMPORTANT:

  • association name has to be formated as : [relationship_name]_[child_schema_name]
  • an incoming_relationship with the exact same name has to be added in the child schema.

Example

# Describes a relationship: (User)-[:WROTE]->(Post)
schema "User" do
  outgoing_relationship :wrote_post, EctoNeo4j.Integration.Post
end

Options

:unique: set to true, the association will be a has_one. Set to false, association will be has_many. [Default: false]