class Sequel::Postgres::PropertyGraph::Generator::Target

  1. lib/sequel/adapters/shared/postgres.rb
Superclass: self

Target is used for the block passed to Edge#source and Edge#destination, used to configure the source and destination of property graph edges.

Methods

Public Class

  1. new

Public Instance

  1. data
  2. key
  3. references

Constants

Data = Struct.new(:name, :key, :references)  

Public Class methods

new(name, &block)

name specifies the name of the source or destination.

[show source]
    # File lib/sequel/adapters/shared/postgres.rb
350 def initialize(name, &block)
351   @name = name
352   @key = nil
353   @references = nil
354   instance_exec(&block) if block
355   freeze
356 end

Public Instance methods

data()
[show source]
    # File lib/sequel/adapters/shared/postgres.rb
358 def data
359   Data.new(@name, @key, @references).freeze
360 end
key(keys)

Set the column(s) to use for the KEY clause, which are the columns in the edge table that reference columns in the source or destination. Should be combined with references to specify the columns being referenced.

key(:vertex_id)
# KEY (vertex_id)

key([:vertex_id1, :vertex_id2])
# KEY (vertex_id1, vertex_id2)
[show source]
    # File lib/sequel/adapters/shared/postgres.rb
372 def key(keys)
373   @key = Array(keys)
374 end
references(refs)

Set the column(s) to use for the REFERENCES clause, which are the columns in the source or destination table that are referenced by the edge table. Should be combined with key to specify the columns doing the referencing.

references(:id)
# REFERENCES (id)

references([:id1, :id2])
# REFERENCES (id1, id2)
[show source]
    # File lib/sequel/adapters/shared/postgres.rb
385 def references(refs)
386   @references = Array(refs)
387 end