Module: ElasticGraph::Warehouse::SchemaDefinition::ScalarTypeExtension

Defined in:
elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/scalar_type_extension.rb

Overview

Extends SchemaDefinition::SchemaElements::ScalarType to add warehouse column type conversion.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#warehouse_column_typeObject (readonly)

Warehouse column type configured on this scalar type.



18
19
20
# File 'elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/scalar_type_extension.rb', line 18

def warehouse_column_type
  @warehouse_column_type
end

Instance Method Details

#to_warehouse_column_typeString

Note:

Built-in ElasticGraph scalar types are automatically configured with appropriate warehouse column types. Custom scalar types must explicitly call warehouse_column to specify their warehouse type.

Returns the warehouse column type representation for this scalar type.

Returns:

  • (String)

    the SQL type string (e.g., "INT", "DOUBLE", "BOOLEAN", "STRING")

Raises:

  • (RuntimeError)

    if warehouse_column_type has not been configured



34
35
36
37
# File 'elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/scalar_type_extension.rb', line 34

def to_warehouse_column_type
  warehouse_column_type || raise(Errors::SchemaError, "Warehouse column type not configured for scalar type `#{name}`. " \
    'To proceed, call `warehouse_column type: "TYPE"` on the scalar type definition.')
end

#warehouse_column(type:) ⇒ String

Configures warehouse column type for this scalar type.

Parameters:

  • type (String)

    the warehouse column type (e.g., "TIMESTAMP", "BINARY")

Returns:

  • (String)

    the configured warehouse column type



24
25
26
# File 'elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/scalar_type_extension.rb', line 24

def warehouse_column(type:)
  @warehouse_column_type = type
end