pub enum CreateTypeDefinition<X: Extension = NoExt> {
Enum {
labels: ThinVec<Literal>,
meta: Meta,
},
EnumFromQuery {
query: Box<Query<X>>,
meta: Meta,
},
Alias {
data_type: DataType<X>,
meta: Meta,
},
}Expand description
The AS <definition> body of a CreateType. DuckDB’s CREATE TYPE grammar has a
dedicated ENUM rule distinct from the general data-type grammar — its labels are
parser-restricted to string constants (ENUM(1, 2) is a parse error, unlike the
data-type-position x::ENUM(...) cast, which parses any modifier and only bind-rejects
a non-string) — so an enum definition is its own variant rather than a
DataType::Enum. Every non-ENUM spelling (STRUCT/MAP/
UNION, an alias to a named type, arrays, DECIMAL(p, s), …) reuses the shared data
type via Alias.
Variants§
Enum
AS ENUM ('a', 'b', …) — a labelled enumeration. The label list may be empty
(ENUM (), which DuckDB accepts) and each label is a string literal.
Fields
EnumFromQuery
AS ENUM (<query>) — the enum labels are drawn from a query’s single column
(ENUM (SELECT DISTINCT month FROM …)); the parenthesized query reuses Query.
Fields
Alias
AS <type> — an alias to another type: a scalar (AS VARCHAR), a composite/nested
constructor (AS STRUCT(…) / AS MAP(…) / AS UNION(…)), an array (AS my_int[]),
or a named user type. Reuses the shared DataType grammar.
Trait Implementations§
Source§impl<X: Clone + Extension> Clone for CreateTypeDefinition<X>
impl<X: Clone + Extension> Clone for CreateTypeDefinition<X>
Source§fn clone(&self) -> CreateTypeDefinition<X>
fn clone(&self) -> CreateTypeDefinition<X>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, X> Deserialize<'de> for CreateTypeDefinition<X>where
X: Deserialize<'de> + Extension,
impl<'de, X> Deserialize<'de> for CreateTypeDefinition<X>where
X: Deserialize<'de> + Extension,
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<X: Eq + Extension> Eq for CreateTypeDefinition<X>
Source§impl<X: Extension + Render> Render for CreateTypeDefinition<X>
impl<X: Extension + Render> Render for CreateTypeDefinition<X>
Source§fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
Source§fn operand_binding_power(&self) -> Option<BindingPower>
fn operand_binding_power(&self) -> Option<BindingPower>
None (the default) for a self-delimiting node — an atom, call, or
constructor — that never needs parentheses. Read moreSource§impl<X> Serialize for CreateTypeDefinition<X>
impl<X> Serialize for CreateTypeDefinition<X>
Source§impl<X: Extension> Spanned for CreateTypeDefinition<X>
impl<X: Extension> Spanned for CreateTypeDefinition<X>
impl<X: PartialEq + Extension> StructuralPartialEq for CreateTypeDefinition<X>
Auto Trait Implementations§
impl<X> Freeze for CreateTypeDefinition<X>where
X: Freeze,
impl<X> RefUnwindSafe for CreateTypeDefinition<X>where
X: RefUnwindSafe,
impl<X> Send for CreateTypeDefinition<X>where
X: Send,
impl<X> Sync for CreateTypeDefinition<X>where
X: Sync,
impl<X> Unpin for CreateTypeDefinition<X>where
X: Unpin,
impl<X> UnsafeUnpin for CreateTypeDefinition<X>where
X: UnsafeUnpin,
impl<X> UnwindSafe for CreateTypeDefinition<X>where
X: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DynAstExt for T
impl<T> DynAstExt for T
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&dyn Any for downcasting a node back to its concrete type.Source§fn dyn_clone(&self) -> Box<dyn DynAstExt>
fn dyn_clone(&self) -> Box<dyn DynAstExt>
Clone (whose
Self-returning signature cannot go through a vtable).Source§fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
PartialEq (whose &Self argument cannot go through a vtable). Equal
iff other holds the same concrete type and that type deems the values
equal; differently-typed nodes are never equal.