Skip to main content

ColumnOption

Enum ColumnOption 

Source
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,
}
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)

ClickHouse

§

Ephemeral(Option<Expr>)

EPHEMERAL [<expr>]

ClickHouse

§

Alias(Expr)

ALIAS <expr>

ClickHouse

§

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_INCREMENT or SQLite’s AUTOINCREMENT
§

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: GeneratedAs

How 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: Option<Expr>

Optional expression used to generate the column value.

§generation_expr_mode: Option<GeneratedExpressionMode>

Mode of the generated expression (VIRTUAL or STORED) when generation_expr is present.

§generated_keyword: bool

false if ‘GENERATED ALWAYS’ is skipped (option starts with AS)

§

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

Source§

fn clone(&self) -> ColumnOption

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ColumnOption

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for ColumnOption

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<CheckConstraint> for ColumnOption

Source§

fn from(c: CheckConstraint) -> ColumnOption

Converts to this type from the input type.
Source§

impl From<ForeignKeyConstraint> for ColumnOption

Source§

fn from(fk: ForeignKeyConstraint) -> ColumnOption

Converts to this type from the input type.
Source§

impl From<PrimaryKeyConstraint> for ColumnOption

Source§

fn from(c: PrimaryKeyConstraint) -> ColumnOption

Converts to this type from the input type.
Source§

impl From<UniqueConstraint> for ColumnOption

Source§

fn from(c: UniqueConstraint) -> ColumnOption

Converts to this type from the input type.
Source§

impl Hash for ColumnOption

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for ColumnOption

Source§

fn cmp(&self, other: &ColumnOption) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ColumnOption

Source§

fn eq(&self, other: &ColumnOption) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ColumnOption

Source§

fn partial_cmp(&self, other: &ColumnOption) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Spanned for ColumnOption

§partial span

Missing spans:

Source§

fn span(&self) -> Span

Return the Span (the minimum and maximum Location) for this AST node, by recursively combining the spans of its children.
Source§

impl Eq for ColumnOption

Source§

impl StructuralPartialEq for ColumnOption

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.