pub enum ColumnOption {
Show 15 variants
Null,
NotNull,
Default(Expr),
Materialized(Expr),
Ephemeral(Option<Expr>),
Alias(Expr),
Unique {
is_primary: bool,
characteristics: Option<ConstraintCharacteristics>,
},
ForeignKey {
foreign_table: ObjectName,
referred_columns: Vec<Ident>,
on_delete: Option<ReferentialAction>,
on_update: Option<ReferentialAction>,
characteristics: Option<ConstraintCharacteristics>,
},
Check(Expr),
DialectSpecific(Vec<Token>),
CharacterSet(ObjectName),
Comment(String),
OnUpdate(Expr),
Generated {
generated_as: GeneratedAs,
sequence_options: Option<Vec<SequenceOptions>>,
generation_expr: Option<Expr>,
generation_expr_mode: Option<GeneratedExpressionMode>,
generated_keyword: bool,
},
Options(Vec<SqlOption>),
}Expand description
ColumnOptions are modifiers that follow a column definition in a CREATE TABLE statement.
Variants§
Null
NULL
NotNull
NOT NULL
Default(Expr)
DEFAULT <restricted-expr>
Materialized(Expr)
ClickHouse supports MATERIALIZE, EPHEMERAL and ALIAS expr to generate default values.
Syntax: b INT MATERIALIZE (a + 1)
ClickHouse
MATERIALIZE <expr>
Ephemeral(Option<Expr>)
EPHEMERAL [<expr>]
Alias(Expr)
ALIAS <expr>
Unique
{ PRIMARY KEY | UNIQUE } [<constraint_characteristics>]
ForeignKey
A referential integrity constraint ([FOREIGN KEY REFERENCES <foreign_table> (<referred_columns>) { [ON DELETE <referential_action>] [ON UPDATE <referential_action>] | [ON UPDATE <referential_action>] [ON DELETE <referential_action>] } [<constraint_characteristics>] ).
Fields
foreign_table: ObjectNameon_delete: Option<ReferentialAction>on_update: Option<ReferentialAction>characteristics: Option<ConstraintCharacteristics>Check(Expr)
CHECK (<expr>)
DialectSpecific(Vec<Token>)
Dialect-specific options, such as:
- MySQL’s
AUTO_INCREMENTor SQLite’sAUTOINCREMENT - …
CharacterSet(ObjectName)
Comment(String)
OnUpdate(Expr)
Generated
Generateds are modifiers that follow a column definition in a CREATE TABLE statement.
Fields
generated_as: GeneratedAssequence_options: Option<Vec<SequenceOptions>>generation_expr_mode: Option<GeneratedExpressionMode>Options(Vec<SqlOption>)
Trait Implementations§
source§impl Clone for ColumnOption
impl Clone for ColumnOption
source§fn clone(&self) -> ColumnOption
fn clone(&self) -> ColumnOption
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ColumnOption
impl Debug for ColumnOption
source§impl Display for ColumnOption
impl Display for ColumnOption
source§impl Hash for ColumnOption
impl Hash for ColumnOption
source§impl Ord for ColumnOption
impl Ord for ColumnOption
source§fn cmp(&self, other: &ColumnOption) -> Ordering
fn cmp(&self, other: &ColumnOption) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for ColumnOption
impl PartialEq for ColumnOption
source§impl PartialOrd for ColumnOption
impl PartialOrd for ColumnOption
source§impl Visit for ColumnOption
impl Visit for ColumnOption
source§impl VisitMut for ColumnOption
impl VisitMut for ColumnOption
fn visit<V>(&mut self, visitor: &mut V) -> ControlFlow<<V as VisitorMut>::Break>where
V: VisitorMut,
impl Eq for ColumnOption
impl StructuralPartialEq for ColumnOption
Auto Trait Implementations§
impl Freeze for ColumnOption
impl RefUnwindSafe for ColumnOption
impl Send for ColumnOption
impl Sync for ColumnOption
impl Unpin for ColumnOption
impl UnwindSafe for ColumnOption
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more