Class: KDomain::Schemas::Domain::Model::Column
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- KDomain::Schemas::Domain::Model::Column
- Defined in:
- lib/k_domain/schemas/domain.rb
Instance Attribute Summary collapse
-
#relationships ⇒ Object
Any column may have a bunch of related models using various relationship types (belong_to, has_one, has_many etc…).
Instance Method Summary collapse
- #csharp_type ⇒ Object
- #db_type ⇒ Object
- #ruby_type ⇒ Object
-
#to_h ⇒ Object
rubocop:disable Metrics/AbcSize.
Instance Attribute Details
#relationships ⇒ Object
Any column may have a bunch of related models using various relationship types (belong_to, has_one, has_many etc…)
31 32 33 |
# File 'lib/k_domain/schemas/domain.rb', line 31 def relationships @relationships end |
Instance Method Details
#csharp_type ⇒ Object
45 46 47 48 49 |
# File 'lib/k_domain/schemas/domain.rb', line 45 def csharp_type return @csharp_type if defined? @csharp_type @csharp_type = KDomain::Schemas::CSHARP_TYPE[type] || '******' end |
#db_type ⇒ Object
33 34 35 36 37 |
# File 'lib/k_domain/schemas/domain.rb', line 33 def db_type return @db_type if defined? @db_type @db_type = KDomain::Schemas::DB_TYPE[type] || '******' end |
#ruby_type ⇒ Object
39 40 41 42 43 |
# File 'lib/k_domain/schemas/domain.rb', line 39 def ruby_type return @ruby_type if defined? @ruby_type @ruby_type = KDomain::Schemas::RUBY_TYPE[type] || '******' end |
#to_h ⇒ Object
rubocop:disable Metrics/AbcSize
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/k_domain/schemas/domain.rb', line 52 def to_h { name: name, name_plural: name_plural, type: type, precision: precision, scale: scale, default: default, default_as_code: value_as_code(default), null: null, null_as_code: value_as_code(null), # handlebars does not like null property name limit: limit, array: array, array_as_code: value_as_code(array), db_type: db_type, ruby_type: ruby_type, csharp_type: csharp_type, structure_type: structure_type, relationships: relationships } end |