Class: ElasticGraph::Warehouse::SchemaDefinition::FieldTypeConverter
- Inherits:
-
Object
- Object
- ElasticGraph::Warehouse::SchemaDefinition::FieldTypeConverter
- Defined in:
- lib/elastic_graph/warehouse/schema_definition/field_type_converter.rb
Overview
Converts ElasticGraph field types to warehouse column types.
Class Method Summary collapse
-
.convert(field_type) ⇒ String
Converts a field type to a warehouse column type string.
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>>`.
22 23 24 25 26 27 28 29 30 |
# File '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 |