Class: Lutaml::Qea::Models::EaDatatype

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/lutaml/qea/models/ea_datatype.rb

Overview

Represents a data type definition from t_datatypes table

This table stores database-specific type definitions and mappings. It maps database vendor types (e.g., “VARCHAR2” in Oracle) to generic types (e.g., “varchar”). This is metadata for database schema generation, not UML DataType instances.

Examples:

datatype = EaDatatype.new
datatype.type #=> "DDL"
datatype.product_name #=> "Oracle"
datatype.data_type #=> "VARCHAR2"
datatype.generic_type #=> "varchar"

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

from_db_row, #primary_key

Class Method Details

.primary_key_columnObject



43
44
45
# File 'lib/lutaml/qea/models/ea_datatype.rb', line 43

def self.primary_key_column
  :datatypeid
end

.table_nameObject



39
40
41
# File 'lib/lutaml/qea/models/ea_datatype.rb', line 39

def self.table_name
  "t_datatypes"
end

Instance Method Details

#code_type?Boolean

Check if this is a Code type

Returns:

  • (Boolean)


55
56
57
# File 'lib/lutaml/qea/models/ea_datatype.rb', line 55

def code_type?
  type == "Code"
end

#ddl_type?Boolean

Check if this is a DDL type

Returns:

  • (Boolean)


49
50
51
# File 'lib/lutaml/qea/models/ea_datatype.rb', line 49

def ddl_type?
  type == "DDL"
end

#has_length?Boolean

Check if type has length parameter

Returns:

  • (Boolean)


67
68
69
# File 'lib/lutaml/qea/models/ea_datatype.rb', line 67

def has_length?
  size == 1 || !haslength.nil?
end

#has_precision?Boolean

Check if type has precision parameter

Returns:

  • (Boolean)


73
74
75
# File 'lib/lutaml/qea/models/ea_datatype.rb', line 73

def has_precision?
  size == 2
end

#type_signatureString

Get full type signature with size/precision

Returns:

  • (String)


79
80
81
82
83
84
85
86
87
88
# File 'lib/lutaml/qea/models/ea_datatype.rb', line 79

def type_signature
  case size
  when 1
    "#{datatype}(#{defaultlen})"
  when 2
    "#{datatype}(#{defaultprec},#{defaultscale})"
  else
    datatype
  end
end

#user_defined?Boolean

Check if this is a user-defined type

Returns:

  • (Boolean)


61
62
63
# File 'lib/lutaml/qea/models/ea_datatype.rb', line 61

def user_defined?
  user == 1
end