Class: ActiveRecordSpannerAdapter::Table::Column
- Inherits:
-
Object
- Object
- ActiveRecordSpannerAdapter::Table::Column
- Defined in:
- lib/activerecord_spanner_adapter/table/column.rb
Instance Attribute Summary collapse
-
#allow_commit_timestamp ⇒ Object
Returns the value of attribute allow_commit_timestamp.
-
#default ⇒ Object
Returns the value of attribute default.
-
#default_function ⇒ Object
Returns the value of attribute default_function.
-
#generated ⇒ Object
Returns the value of attribute generated.
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nullable ⇒ Object
Returns the value of attribute nullable.
-
#ordinal_position ⇒ Object
Returns the value of attribute ordinal_position.
-
#primary_key ⇒ Object
Returns the value of attribute primary_key.
-
#schema_name ⇒ Object
Returns the value of attribute schema_name.
-
#table_name ⇒ Object
Returns the value of attribute table_name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(table_name, name, type, schema_name: "", limit: nil, ordinal_position: nil, nullable: true, allow_commit_timestamp: nil, default: nil, default_function: nil, generated: nil, primary_key: false) ⇒ Column
constructor
A new instance of Column.
- #options ⇒ Object
- #spanner_type ⇒ Object
Constructor Details
#initialize(table_name, name, type, schema_name: "", limit: nil, ordinal_position: nil, nullable: true, allow_commit_timestamp: nil, default: nil, default_function: nil, generated: nil, primary_key: false) ⇒ Column
Returns a new instance of Column.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 23 def initialize \ table_name, name, type, schema_name: "", limit: nil, ordinal_position: nil, nullable: true, allow_commit_timestamp: nil, default: nil, default_function: nil, generated: nil, primary_key: false @schema_name = schema_name.to_s @table_name = table_name.to_s @name = name.to_s @type = type @limit = limit @nullable = nullable != false @ordinal_position = ordinal_position = @default = default @default_function = default_function @generated = generated == true @primary_key = primary_key end |
Instance Attribute Details
#allow_commit_timestamp ⇒ Object
Returns the value of attribute allow_commit_timestamp.
16 17 18 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 16 def end |
#default ⇒ Object
Returns the value of attribute default.
17 18 19 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 17 def default @default end |
#default_function ⇒ Object
Returns the value of attribute default_function.
18 19 20 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 18 def default_function @default_function end |
#generated ⇒ Object
Returns the value of attribute generated.
19 20 21 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 19 def generated @generated end |
#limit ⇒ Object
Returns the value of attribute limit.
14 15 16 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 14 def limit @limit end |
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 12 def name @name end |
#nullable ⇒ Object
Returns the value of attribute nullable.
21 22 23 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 21 def nullable @nullable end |
#ordinal_position ⇒ Object
Returns the value of attribute ordinal_position.
15 16 17 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 15 def ordinal_position @ordinal_position end |
#primary_key ⇒ Object
Returns the value of attribute primary_key.
20 21 22 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 20 def primary_key @primary_key end |
#schema_name ⇒ Object
Returns the value of attribute schema_name.
10 11 12 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 10 def schema_name @schema_name end |
#table_name ⇒ Object
Returns the value of attribute table_name.
11 12 13 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 11 def table_name @table_name end |
#type ⇒ Object
Returns the value of attribute type.
13 14 15 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 13 def type @type end |
Instance Method Details
#options ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 55 def { limit: limit, null: nullable, allow_commit_timestamp: }.delete_if { |_, v| v.nil? } end |
#spanner_type ⇒ Object
50 51 52 53 |
# File 'lib/activerecord_spanner_adapter/table/column.rb', line 50 def spanner_type return "#{type}(#{limit || 'MAX'})" if limit_allowed? type end |