User Defined Type (UDT) runtime support for ScyllaDB.
Handles encoding/decoding UDT values for Xandra, CQL generation for UDT operations, and UDT schema management.
ScyllaDB UDTs are represented as tuples in Xandra. A UDT
{field1_val, field2_val} maps to a map %{field1: val1, field2: val2}.
Summary
Functions
Generates CQL for altering a UDT (add/rename fields)
Generates CQL for creating a UDT
Decodes a UDT tuple from Xandra into a map
Generates CQL for dropping a UDT
Encodes a map value into UDT format for Xandra
Returns the CQL type string for a UDT field type
Generates CQL to list all UDTs in keyspace
Returns all UDTs defined in a resource's attributes
Generates CQL to check if UDT exists
Validates a UDT field specification
Types
@type udt_schema() :: %{ name: atom(), type_name: String.t(), fields: [udt_field_spec()] }
Functions
@spec alter_type_cql(String.t() | atom(), :add | :rename, [udt_field_spec()]) :: String.t()
Generates CQL for altering a UDT (add/rename fields)
@spec create_type_cql(String.t() | atom(), [udt_field_spec()]) :: String.t()
Generates CQL for creating a UDT
Decodes a UDT tuple from Xandra into a map
Generates CQL for dropping a UDT
Encodes a map value into UDT format for Xandra
Returns the CQL type string for a UDT field type
@spec list_types_cql() :: String.t()
Generates CQL to list all UDTs in keyspace
@spec resource_udts(module()) :: [udt_schema()]
Returns all UDTs defined in a resource's attributes
Generates CQL to check if UDT exists
@spec validate_fields([udt_field_spec()]) :: :ok | {:error, String.t()}
Validates a UDT field specification