Class: KDomain::DomainModel::ColumnOld
- Inherits:
-
Object
- Object
- KDomain::DomainModel::ColumnOld
- Defined in:
- lib/k_domain/schemas/domain/old/column_old.rb
Constant Summary collapse
- RUBY_TYPE =
DONE
{ string: 'String', text: 'String', primary_key: 'Integer', # this could be GUID in future foreign_key: 'Integer', # this could be GUID in future integer: 'Integer', boolean: 'Boolean', float: 'Float', decimal: 'Decimal', datetime: 'DateTime', date: 'DateTime', json: 'Hash', jsonb: 'Hash', hstore: 'Hash' }.freeze
- CSHARP_TYPE =
DONE
{ string: 'string', text: 'string', # NEED TO DEAL WITH THIS BETTER integer: 'int', boolean: 'bool', decimal: 'decimal', float: 'double', datetime: 'DateTime', date: 'DateTime', json: 'object', jsonb: 'object', hstore: 'object' }.freeze
- DB_TYPE =
this is used by the ruby migration files DONE
{ boolean: 'boolean', primary_key: 'integer', foreign_key: 'integer', integer: 'integer', decimal: 'decimal', float: 'float', datetime: 'datetime', date: 'date', text: 'text', string: 'string', json: 'json', jsonb: 'jsonb', hstore: 'hstore' }.freeze
- SIMPLE_ATTRIBS =
%i[ name name_plural type structure_type foreign_key? foreign_table foreign_id ].freeze
- DETAILED_ATTRIBS =
SIMPLE_ATTRIBS + %i[ title required reference_type db_type ruby_type csharp_type format_type description belongs_to ]
- EXTRA_ATTRIBS =
DETAILED_ATTRIBS + %i[ precision scale default null limit array ]
Instance Attribute Summary collapse
-
#array ⇒ Object
Returns the value of attribute array.
-
#belongs_to ⇒ Object
Returns the value of attribute belongs_to.
-
#default ⇒ Object
Returns the value of attribute default.
-
#description ⇒ Object
Returns the value of attribute description.
-
#foreign_id ⇒ Object
(also: #reference_table)
this may not always be accurate, should support override.
-
#foreign_key ⇒ Object
(also: #foreign_key?)
Returns the value of attribute foreign_key.
-
#foreign_table ⇒ Object
Returns the value of attribute foreign_table.
-
#format_type ⇒ Object
‘references’ if foreign key, ‘primary_key’ if primary key, will map_from_type(type)) | attr_accessor :db_type.
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#name ⇒ Object
Name of the column.
-
#name_plural ⇒ Object
Name of the column in plural form.
-
#null ⇒ Object
(also: #nullable)
Returns the value of attribute null.
-
#precision ⇒ Object
Extra DB attributes.
-
#reference_type ⇒ Object
Returns the value of attribute reference_type.
-
#required ⇒ Object
true.
-
#scale ⇒ Object
Returns the value of attribute scale.
-
#structure_type ⇒ Object
:data, :foreign_key, :timestamp.
-
#title ⇒ Object
Human readable title.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#csharp_type ⇒ Object
DONE.
-
#db_type ⇒ Object
DONE.
- #debug(*flags) ⇒ Object
- #format_array ⇒ Object
- #format_default ⇒ Object
- #format_null ⇒ Object
-
#ruby_type ⇒ Object
DONE.
Instance Attribute Details
#array ⇒ Object
Returns the value of attribute array.
125 126 127 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 125 def array @array end |
#belongs_to ⇒ Object
Returns the value of attribute belongs_to.
113 114 115 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 113 def belongs_to @belongs_to end |
#default ⇒ Object
Returns the value of attribute default.
121 122 123 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 121 def default @default end |
#description ⇒ Object
Returns the value of attribute description.
108 109 110 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 108 def description @description end |
#foreign_id ⇒ Object Also known as: reference_table
this may not always be accurate, should support override
115 116 117 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 115 def foreign_id @foreign_id end |
#foreign_key ⇒ Object Also known as: foreign_key?
Returns the value of attribute foreign_key.
110 111 112 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 110 def foreign_key @foreign_key end |
#foreign_table ⇒ Object
Returns the value of attribute foreign_table.
112 113 114 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 112 def foreign_table @foreign_table end |
#format_type ⇒ Object
‘references’ if foreign key, ‘primary_key’ if primary key, will map_from_type(type)) | attr_accessor :db_type
107 108 109 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 107 def format_type @format_type end |
#limit ⇒ Object
Returns the value of attribute limit.
124 125 126 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 124 def limit @limit end |
#name ⇒ Object
Name of the column
88 89 90 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 88 def name @name end |
#name_plural ⇒ Object
Name of the column in plural form
91 92 93 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 91 def name_plural @name_plural end |
#null ⇒ Object Also known as: nullable
Returns the value of attribute null.
122 123 124 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 122 def null @null end |
#precision ⇒ Object
Extra DB attributes
119 120 121 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 119 def precision @precision end |
#reference_type ⇒ Object
Returns the value of attribute reference_type.
102 103 104 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 102 def reference_type @reference_type end |
#required ⇒ Object
true
99 100 101 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 99 def required @required end |
#scale ⇒ Object
Returns the value of attribute scale.
120 121 122 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 120 def scale @scale end |
#structure_type ⇒ Object
:data, :foreign_key, :timestamp
101 102 103 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 101 def structure_type @structure_type end |
#title ⇒ Object
Human readable title
96 97 98 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 96 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
93 94 95 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 93 def type @type end |
Instance Method Details
#csharp_type ⇒ Object
DONE
158 159 160 161 162 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 158 def csharp_type return @csharp_type if defined? @csharp_type @csharp_type = CSHARP_TYPE[type] || '******' end |
#db_type ⇒ Object
DONE
144 145 146 147 148 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 144 def db_type return @db_type if defined? @db_type @db_type = DB_TYPE[type] || '******' end |
#debug(*flags) ⇒ Object
164 165 166 167 168 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 164 def debug(*flags) debug_simple if flags.include?(:simple) debug_detailed if flags.include?(:detailed) debug_extra if flags.include?(:extra) end |
#format_array ⇒ Object
139 140 141 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 139 def format_array array.nil? ? '' : array.to_s end |
#format_default ⇒ Object
127 128 129 130 131 132 133 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 127 def format_default return '' if default.nil? return "\"#{default}\"" if default.is_a?(String) # || default.is_a?(Symbol) default.to_s end |
#format_null ⇒ Object
135 136 137 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 135 def format_null null.nil? ? '' : null.to_s end |
#ruby_type ⇒ Object
DONE
151 152 153 154 155 |
# File 'lib/k_domain/schemas/domain/old/column_old.rb', line 151 def ruby_type return @ruby_type if defined? @ruby_type @ruby_type = RUBY_TYPE[type] || '******' end |