Class: PgGraph::Type::TableColumn
- Defined in:
- lib/pg_graph/type/type.rb,
lib/pg_graph/type/dump_type.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#that_link_column ⇒ Object
readonly
Postgres column in the subject table that directly or indirectly links to the embedding record.
-
#this_link_column ⇒ Object
readonly
Postgres column in the embedding record that links (directly or indirectly) to the subject table.
Attributes inherited from Column
Attributes inherited from Field
Instance Method Summary collapse
- #dot_lookup(key) ⇒ Object
- #dump_type ⇒ Object
-
#initialize(record_type, name, type, this_link_column, that_link_column, **opts) ⇒ TableColumn
constructor
A new instance of TableColumn.
Methods inherited from Column
#dump, #generated?, #identity?, #kind?, #nullable?, #primary_key?, #readonly?, #reference?, #unique?
Methods included from TableObject
#record_type, #table, #table_type
Methods inherited from Field
#identifier, #schema_identifier
Methods inherited from Node
#dump, #guid, #identifier, #inspect, #inspect_inner, #schema_identifier
Constructor Details
#initialize(record_type, name, type, this_link_column, that_link_column, **opts) ⇒ TableColumn
Returns a new instance of TableColumn.
578 579 580 581 582 583 584 |
# File 'lib/pg_graph/type/type.rb', line 578 def initialize(record_type, name, type, this_link_column, that_link_column, **opts) constrain record_type, RecordType constrain type, TableType super(record_type, name, nil, type, **opts) @this_link_column = this_link_column @that_link_column = that_link_column end |
Instance Attribute Details
#that_link_column ⇒ Object (readonly)
Postgres column in the subject table that directly or indirectly links to the embedding record. This is typically the ‘<this-table>_id’ column of that table in 1:N relations
574 575 576 |
# File 'lib/pg_graph/type/type.rb', line 574 def that_link_column @that_link_column end |
#this_link_column ⇒ Object (readonly)
Postgres column in the embedding record that links (directly or indirectly) to the subject table. This is typically the id column
569 570 571 |
# File 'lib/pg_graph/type/type.rb', line 569 def this_link_column @this_link_column end |
Instance Method Details
#dot_lookup(key) ⇒ Object
586 |
# File 'lib/pg_graph/type/type.rb', line 586 def dot_lookup(key) type[key] end |
#dump_type ⇒ Object
56 57 58 |
# File 'lib/pg_graph/type/dump_type.rb', line 56 def dump_type print " (#{this_link_column} -> #{type.table.name}.#{that_link_column}) (TableColumn)" end |