Mapping between Ash attribute types and ClickHouse column types.
ClickHouse is a strongly-typed columnar store. When generating CREATE TABLE
statements and when encoding query parameters, the data layer needs to know
the ClickHouse type that corresponds to each Ash attribute.
The mapping here favours ClickHouse types that are safe and broadly useful:
| Ash type | ClickHouse type |
|---|---|
:uuid | UUID |
:string / :atom / :ci_string | String |
:integer | Int64 |
:float | Float64 |
:boolean | UInt8 |
:utc_datetime / :naive_datetime | DateTime / DateTime64 |
:date | Date |
:time | String |
:decimal | Decimal |
:map | Map(String, String) |
:array / :list | Array(String) |
Summary
Functions
Maps an Ash attribute type to a ClickHouse column type string.
Returns the set of attribute names (atom) that are Atom-typed.
Builds a map of attribute name => ClickHouse type string for a resource.
Resolves the ClickHouse type for an Ash attribute struct, preferring the
attribute's storage_type/1 when available.
Returns the set of attribute names (atom and string) that are UUID-typed.
Converts a 16-byte UUID binary to its canonical 36-character string form.
Returns true if the given binary looks like a canonical UUID string.
Converts a 36-character UUID string to its 16-byte binary form for ClickHouse.
Functions
Maps an Ash attribute type to a ClickHouse column type string.
Returns the set of attribute names (atom) that are Atom-typed.
Builds a map of attribute name => ClickHouse type string for a resource.
Resolves the ClickHouse type for an Ash attribute struct, preferring the
attribute's storage_type/1 when available.
Returns the set of attribute names (atom and string) that are UUID-typed.
Converts a 16-byte UUID binary to its canonical 36-character string form.
Returns true if the given binary looks like a canonical UUID string.
Converts a 36-character UUID string to its 16-byte binary form for ClickHouse.