Class: Pinspec::Table
- Inherits:
-
Data
- Object
- Data
- Pinspec::Table
- Defined in:
- lib/pinspec/types.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#id_type ⇒ Object
readonly
Returns the value of attribute id_type.
-
#indexes ⇒ Object
readonly
Returns the value of attribute indexes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#primary_key ⇒ Object
readonly
Returns the value of attribute primary_key.
Instance Method Summary collapse
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns
428 429 430 |
# File 'lib/pinspec/types.rb', line 428 def columns @columns end |
#id_type ⇒ Object (readonly)
Returns the value of attribute id_type
428 429 430 |
# File 'lib/pinspec/types.rb', line 428 def id_type @id_type end |
#indexes ⇒ Object (readonly)
Returns the value of attribute indexes
428 429 430 |
# File 'lib/pinspec/types.rb', line 428 def indexes @indexes end |
#name ⇒ Object (readonly)
Returns the value of attribute name
428 429 430 |
# File 'lib/pinspec/types.rb', line 428 def name @name end |
#primary_key ⇒ Object (readonly)
Returns the value of attribute primary_key
428 429 430 |
# File 'lib/pinspec/types.rb', line 428 def primary_key @primary_key end |
Instance Method Details
#column(name) ⇒ Object
429 430 431 |
# File 'lib/pinspec/types.rb', line 429 def column(name) columns.find { |c| c.name == name.to_s } end |
#required_columns ⇒ Object
437 438 439 |
# File 'lib/pinspec/types.rb', line 437 def required_columns columns.reject { |c| Array(primary_key).include?(c.name) }.select(&:required?) end |
#unique_indexes ⇒ Object
433 434 435 |
# File 'lib/pinspec/types.rb', line 433 def unique_indexes indexes.select(&:unique?) end |