pub enum ColumnOption {
Show 23 variants
Null,
NotNull,
Default(Expr),
Materialized(Expr),
Ephemeral(Option<Expr>),
Alias(Expr),
PrimaryKey(PrimaryKeyConstraint),
Unique(UniqueConstraint),
ForeignKey(ForeignKeyConstraint),
Check(CheckConstraint),
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),
Srid(Box<Expr>),
Invisible,
}sql only.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)
MATERIALIZE <expr>
Syntax: b INT MATERIALIZE (a + 1)
Ephemeral(Option<Expr>)
EPHEMERAL [<expr>]
Alias(Expr)
ALIAS <expr>
PrimaryKey(PrimaryKeyConstraint)
PRIMARY KEY [<constraint_characteristics>]
Unique(UniqueConstraint)
UNIQUE [<constraint_characteristics>]
ForeignKey(ForeignKeyConstraint)
A referential integrity constraint (REFERENCES <foreign_table> (<referred_columns>) [ MATCH { FULL | PARTIAL | SIMPLE } ] { [ON DELETE <referential_action>] [ON UPDATE <referential_action>] | [ON UPDATE <referential_action>] [ON DELETE <referential_action>] } [<constraint_characteristics>] ).
Check(CheckConstraint)
CHECK (<expr>)
DialectSpecific(Vec<Token>)
Dialect-specific options, such as:
- MySQL’s
AUTO_INCREMENTor SQLite’sAUTOINCREMENT - …
CharacterSet(ObjectName)
CHARACTER SET <name> column option
Collation(ObjectName)
COLLATE <name> column option
Comment(String)
COMMENT '<text>' column option
OnUpdate(Expr)
ON UPDATE <expr> column option
Generated
Generateds are modifiers that follow a column definition in a CREATE TABLE statement.
Fields
generated_as: GeneratedAsHow the column is generated (e.g. GENERATED ALWAYS, BY DEFAULT, or expression-stored).
sequence_options: Option<Vec<SequenceOptions>>Sequence/identity options when generation is backed by a sequence.
generation_expr_mode: Option<GeneratedExpressionMode>Mode of the generated expression (VIRTUAL or STORED) when generation_expr is present.
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>' , ... ] )Srid(Box<Expr>)
MySQL specific: Spatial reference identifier Syntax:
CREATE TABLE geom (g GEOMETRY NOT NULL SRID 4326);Invisible
MySQL specific: Column is invisible via SELECT * Syntax:
CREATE TABLE t (foo INT, bar INT INVISIBLE);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 From<CheckConstraint> for ColumnOption
impl From<CheckConstraint> for ColumnOption
Source§fn from(c: CheckConstraint) -> ColumnOption
fn from(c: CheckConstraint) -> ColumnOption
Source§impl From<ForeignKeyConstraint> for ColumnOption
impl From<ForeignKeyConstraint> for ColumnOption
Source§fn from(fk: ForeignKeyConstraint) -> ColumnOption
fn from(fk: ForeignKeyConstraint) -> ColumnOption
Source§impl From<PrimaryKeyConstraint> for ColumnOption
impl From<PrimaryKeyConstraint> for ColumnOption
Source§fn from(c: PrimaryKeyConstraint) -> ColumnOption
fn from(c: PrimaryKeyConstraint) -> ColumnOption
Source§impl From<UniqueConstraint> for ColumnOption
impl From<UniqueConstraint> for ColumnOption
Source§fn from(c: UniqueConstraint) -> ColumnOption
fn from(c: UniqueConstraint) -> 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 Spanned for ColumnOption
§partial span
Missing spans:
impl Spanned for ColumnOption
§partial span
Missing spans:
Source§impl Visit for ColumnOption
impl Visit for ColumnOption
Source§impl VisitMut for ColumnOption
impl VisitMut for ColumnOption
Source§fn visit<V>(&mut self, visitor: &mut V) -> ControlFlow<<V as VisitorMut>::Break>where
V: VisitorMut,
fn visit<V>(&mut self, visitor: &mut V) -> ControlFlow<<V as VisitorMut>::Break>where
V: VisitorMut,
VisitorMut. Read moreimpl 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 UnsafeUnpin 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§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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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§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