Class: PgGraph::Type::MmTableColumn
- Inherits:
-
TableColumn
- Object
- HashTree::Set
- Node
- Field
- Column
- TableColumn
- PgGraph::Type::MmTableColumn
- Defined in:
- lib/pg_graph/type/type.rb,
lib/pg_graph/type/dump_type.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#mm_table_type ⇒ Object
readonly
Returns the value of attribute mm_table_type.
-
#that_mm_column ⇒ Object
readonly
Postgres column in the NM table that links to the embedding record.
-
#this_mm_column ⇒ Object
readonly
Postgres column in the NM table that links to this table.
Attributes inherited from TableColumn
#that_link_column, #this_link_column
Attributes inherited from Column
Attributes inherited from Field
Instance Method Summary collapse
- #dump_type ⇒ Object
-
#initialize(record_type, name, that_table_type, mm_table_type, this_link_column, this_mm_column, that_mm_column, that_link_column, **opts) ⇒ MmTableColumn
constructor
:unique in this context means that the associated records of this column are unique.
- #mm_record_type ⇒ Object
-
#mm_table ⇒ Object
The link table between the two tables.
- #that_record_type ⇒ Object
-
#that_table ⇒ Object
The other table in the relationship.
Methods inherited from 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, that_table_type, mm_table_type, this_link_column, this_mm_column, that_mm_column, that_link_column, **opts) ⇒ MmTableColumn
:unique in this context means that the associated records of this column are unique
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
# File 'lib/pg_graph/type/type.rb', line 615 def initialize( record_type, name, that_table_type, mm_table_type, this_link_column, this_mm_column, that_mm_column, that_link_column, **opts) # puts "MmTableColumn#initialize" # indent { # puts "record: #{record_type}" # puts "column: #{name}" # puts this_mm_column # puts this_link_column # puts that_mm_column # puts that_link_column # } constrain record_type, RecordType constrain that_table_type, TableType constrain mm_table_type, TableType mm_table_type.table.mm_table? or raise Error, "Link table expected" super(record_type, name, that_table_type, this_link_column, that_link_column, **opts) @mm_table_type = mm_table_type @this_mm_column = this_mm_column @that_mm_column = that_mm_column end |
Instance Attribute Details
#mm_table_type ⇒ Object (readonly)
Returns the value of attribute mm_table_type.
603 604 605 |
# File 'lib/pg_graph/type/type.rb', line 603 def mm_table_type @mm_table_type end |
#that_mm_column ⇒ Object (readonly)
Postgres column in the NM table that links to the embedding record. This is typically the ‘<that-table>_id’ column
611 612 613 |
# File 'lib/pg_graph/type/type.rb', line 611 def that_mm_column @that_mm_column end |
#this_mm_column ⇒ Object (readonly)
Postgres column in the NM table that links to this table. This is typically the ‘<this-table>_id’ column
607 608 609 |
# File 'lib/pg_graph/type/type.rb', line 607 def this_mm_column @this_mm_column end |
Instance Method Details
#dump_type ⇒ Object
62 63 64 65 66 |
# File 'lib/pg_graph/type/dump_type.rb', line 62 def dump_type print \ " (#{this_link_column} -> #{mm_table.name}.#{this_mm_column}," + " #{mm_table.name}.#{that_mm_column} -> #{that_table.name}.#{that_link_column}) (MmTableColumn)" end |
#mm_record_type ⇒ Object
602 |
# File 'lib/pg_graph/type/type.rb', line 602 def mm_record_type() mm_table_type.record_type end |
#mm_table ⇒ Object
The link table between the two tables
601 |
# File 'lib/pg_graph/type/type.rb', line 601 def mm_table() mm_table_type.table end |
#that_record_type ⇒ Object
598 |
# File 'lib/pg_graph/type/type.rb', line 598 def that_record_type() that_table_type.record_type end |
#that_table ⇒ Object
The other table in the relationship
596 |
# File 'lib/pg_graph/type/type.rb', line 596 def that_table() that_table_type.table end |