Shared CQL type mapping and conversion helpers.
Centralizes the canonical type-to-CQL-string mappings used across
AshScylla.Migration, AshScylla.DataLayer.Udt, and
AshScylla.DataLayer.Collection.
Summary
Functions
Converts an Ash type atom to its CQL type string representation.
Returns the CQL type string for a collection element type atom.
Returns the CQL type string for a given type atom.
Returns the CQL type string for a UDT field type atom.
Returns the list of all known valid CQL type atoms.
Functions
Converts an Ash type atom to its CQL type string representation.
Handles special collection and structured types:
:map— rendered asMAP<key_type, value_type>:array— rendered asLIST<element_type>:set— rendered asSET<element_type>:udt— rendered asfrozen<type_name>
All other atoms are resolved via the canonical cql_type/1 mapping.
The :frozen option wraps the result in frozen<...>.
Options
:key_type— for:map, the CQL key type (default:"TEXT"):value_type— for:map, the CQL value type (default:"TEXT"):element_type— for:array/:set, the CQL element type (default:"TEXT"):type_name— for:udt, the UDT name:frozen— iftrue, wraps the result infrozen<...>
Examples
iex> AshScylla.DataLayer.Types.ash_type_to_cql_type(:uuid, [])
"UUID"
iex> AshScylla.DataLayer.Types.ash_type_to_cql_type(:string, [])
"TEXT"
iex> AshScylla.DataLayer.Types.ash_type_to_cql_type(:map, key_type: "TEXT", value_type: "INT")
"MAP<TEXT, INT>"
iex> AshScylla.DataLayer.Types.ash_type_to_cql_type(:array, element_type: "UUID")
"LIST<UUID>"
Returns the CQL type string for a collection element type atom.
Delegates to cql_type/1.
Examples
iex> AshScylla.DataLayer.Types.cql_element_type(:int)
"INT"
iex> AshScylla.DataLayer.Types.cql_element_type(:float)
"FLOAT"
Returns the CQL type string for a given type atom.
Known types are resolved via the canonical mapping. Unknown types fall back to "TEXT".
Examples
iex> AshScylla.DataLayer.Types.cql_type(:text)
"TEXT"
iex> AshScylla.DataLayer.Types.cql_type(:bigint)
"BIGINT"
iex> AshScylla.DataLayer.Types.cql_type(:custom_type)
"TEXT"
Returns the CQL type string for a UDT field type atom.
Delegates to cql_type/1.
Examples
iex> AshScylla.DataLayer.Types.field_type_to_cql(:text)
"TEXT"
iex> AshScylla.DataLayer.Types.field_type_to_cql(:uuid)
"UUID"
@spec valid_cql_types() :: [atom()]
Returns the list of all known valid CQL type atoms.