pub enum ColumnTypeSpec {
Scalar(ScalarType),
DateTime64 {
datetime64: DateTime64Spec,
},
Nullable {
nullable: Box<ColumnTypeSpec>,
},
LowCardinality {
low_cardinality: Box<ColumnTypeSpec>,
},
Array {
array: StringOnly,
},
Map {
map: (StringOnly, StringOnly),
},
}Expand description
A column type as supplied by untrusted input — the allowlisted recursive shape.
Mirrors the TS ColumnTypeSpec: a bare scalar string, or a single-key wrapper
object (nullable / lowCardinality / array / map).
Variants§
Scalar(ScalarType)
DateTime64
Parametrised DateTime64(precision[, 'timezone']). JSON:
{"datetime64": {"precision": 3, "timezone": "UTC"}}. The single datetime64
key keeps the untagged match unambiguous against the other wrappers.
Fields
datetime64: DateTime64SpecNullable
Fields
nullable: Box<ColumnTypeSpec>LowCardinality
Fields
low_cardinality: Box<ColumnTypeSpec>Array
Fields
array: StringOnlyMap
Fields
map: (StringOnly, StringOnly)Implementations§
Source§impl ColumnTypeSpec
impl ColumnTypeSpec
Sourcepub fn to_ch_type(&self) -> String
pub fn to_ch_type(&self) -> String
The ClickHouse type string for this spec.
For ColumnTypeSpec::DateTime64 this trusts the spec to be valid; untrusted
precision/timezone must be checked first via ColumnTypeSpec::validate (the
table builder does this in its per-column loop).
Sourcepub fn is_datetime64(&self) -> bool
pub fn is_datetime64(&self) -> bool
Whether a DateTime64 is at the core (so a TTL move expression must wrap it
in toDateTime(...)). Propagates through Nullable/LowCardinality and covers
both the bare ScalarType::DateTime64 and the parametrised
ColumnTypeSpec::DateTime64 variant.
Sourcepub fn validate(&self) -> Result<(), SchemaError>
pub fn validate(&self) -> Result<(), SchemaError>
Validate any embedded untrusted parameters (currently the parametrised
DateTime64 precision + timezone) before this type is rendered to SQL.
Recurses through Nullable/LowCardinality. Identifier-shaped scalars/arrays/
maps have nothing to validate here.
Trait Implementations§
Source§impl Clone for ColumnTypeSpec
impl Clone for ColumnTypeSpec
Source§fn clone(&self) -> ColumnTypeSpec
fn clone(&self) -> ColumnTypeSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ColumnTypeSpec
impl Debug for ColumnTypeSpec
Source§impl<'de> Deserialize<'de> for ColumnTypeSpec
impl<'de> Deserialize<'de> for ColumnTypeSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ColumnTypeSpec
Source§impl PartialEq for ColumnTypeSpec
impl PartialEq for ColumnTypeSpec
Source§fn eq(&self, other: &ColumnTypeSpec) -> bool
fn eq(&self, other: &ColumnTypeSpec) -> bool
self and other values to be equal, and is used by ==.