Class: ElasticGraph::Warehouse::SchemaDefinition::FieldTypeConverter

Inherits:
Object
  • Object
show all
Defined in:
elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/field_type_converter.rb

Overview

Converts ElasticGraph field types to warehouse column types.

Class Method Summary collapse

Class Method Details

.convert(field_type) ⇒ String

Converts a field type to a warehouse column type string.

Handles both scalar and list types, unwrapping nullability and delegating to the resolved type's to_warehouse_column_type method. Supports nested arrays like [[String!]] which become ARRAY<ARRAY<STRING>>.

Parameters:

  • field_type (Object)

    the field type to convert

Returns:

  • (String)

    the warehouse column type (e.g., "STRING", "ARRAY", "ARRAY>")



22
23
24
25
26
27
28
29
30
# File 'elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/field_type_converter.rb', line 22

def self.convert(field_type)
  unwrapped_type = field_type.unwrap_non_null

  if unwrapped_type.list?
    "ARRAY<#{convert(unwrapped_type.unwrap_list)}>"
  else
    unwrapped_type.resolved.to_warehouse_column_type
  end
end