Sha256: 3497015acf5bb0616c28617037264a7d19cd7f606b6dfd47637760d42ea2d97d

Contents?: true

Size: 1.72 KB

Versions: 5

Compression:

Stored size: 1.72 KB

Contents

Description:
    This creates Apache AGE edges that work seamlessly with Rails.
    An edge can be created with or without a namespace.
    See the below examples.

Example:
    `bin/rails g apache_age:edge HasJob employee_role start_date:date`

    (hopefully comming soon - but not yet ready is the ability to add start_node and end_node types)
    `bin/rails g apache_age:edge HasJob employee_role start_date:date start_node:person end_node:company`

    This creates:
        `app/edges/has_job.rb`

    with the contents:
        ```
        class HasJob
          include ApacheAge::Entities::Edge

          attribute :employee_role, :string
          attribute :start_date, :date

          validates :employee_role, presence: true
          validates :begin_date, presence: true

          # unique edge validator (remove any attributes that are not important to uniqueness)
          validates_with(
            ApacheAge::Validators::UniqueEdge,
            attributes: [:employee_role, :begin_date :start_node, :end_node]
          )
        end
        ```

    A namespace can also be used:
        `bin/rails g apache_age:edge Animals/Cat name age:integer`

    This creates:
        `app/edges/animals/has_cat.rb`

    with the contents
        ```
        class Animals::HatCat
          include ApacheAge::Entities::Edge

          attribute :name, :string
          attribute :age, :integer

          validates :name, presence: true
          validates :age, presence: true

          # unique edge validator (remove any attributes that are not important to uniqueness)
          validates_with(
            ApacheAge::Validators::UniqueEdge,
            attributes: [:name, :age, :start_node, :end_node]
          )
        end
        ```

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_age-0.6.4 lib/generators/apache_age/edge/USAGE
rails_age-0.6.3 lib/generators/apache_age/edge/USAGE
rails_age-0.6.2 lib/generators/apache_age/edge/USAGE
rails_age-0.6.1 lib/generators/apache_age/edge/USAGE
rails_age-0.6.0 lib/generators/apache_age/edge/USAGE