pub enum ColumnOption {
Show 20 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),
Collation(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>),
Identity(IdentityPropertyKind),
OnConflict(Keyword),
Policy(ColumnPolicy),
Tags(TagsColumnOption),
}
Expand description
ColumnOption
s 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)
MATERIALIZE <expr>
Syntax: b INT MATERIALIZE (a + 1)
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: ObjectName
on_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_INCREMENT
or SQLite’sAUTOINCREMENT
- …
CharacterSet(ObjectName)
Collation(ObjectName)
Comment(String)
OnUpdate(Expr)
Generated
Generated
s are modifiers that follow a column definition in a CREATE TABLE
statement.
Fields
generated_as: GeneratedAs
sequence_options: Option<Vec<SequenceOptions>>
generation_expr_mode: Option<GeneratedExpressionMode>
Options(Vec<SqlOption>)
BigQuery specific: Explicit column options in a view 1 or table 2 Syntax
OPTIONS(description="field desc")
Identity(IdentityPropertyKind)
Creates an identity or an autoincrement column in a table. Syntax
{ IDENTITY | AUTOINCREMENT } [ (seed , increment) | START num INCREMENT num ] [ ORDER | NOORDER ]
OnConflict(Keyword)
SQLite specific: ON CONFLICT option on column definition https://www.sqlite.org/lang_conflict.html
Policy(ColumnPolicy)
Snowflake specific: an option of specifying security masking or projection policy to set on a column. Syntax:
[ WITH ] MASKING POLICY <policy_name> [ USING ( <col_name> , <cond_col1> , ... ) ]
[ WITH ] PROJECTION POLICY <policy_name>
Tags(TagsColumnOption)
Snowflake specific: Specifies the tag name and the tag string value. Syntax:
[ WITH ] TAG ( <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' , ... ] )
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<'de> Deserialize<'de> for ColumnOption
impl<'de> Deserialize<'de> for ColumnOption
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>,
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 Serialize for ColumnOption
impl Serialize for ColumnOption
Source§impl Spanned for ColumnOption
§partial span
Missing spans:
impl Spanned for ColumnOption
§partial span
Missing spans: