Skip to main content

CreateDefinition

Enum CreateDefinition 

Source
pub enum CreateDefinition<'a> {
    ColumnDefinition {
        identifier: Identifier<'a>,
        data_type: DataType<'a>,
    },
    IndexDefinition {
        constraint_span: Option<Span>,
        constraint_symbol: Option<Identifier<'a>>,
        index_type: IndexType,
        index_name: Option<Identifier<'a>>,
        cols: Vec<IndexCol<'a>>,
        index_options: Vec<IndexOption<'a>>,
    },
    ForeignKeyDefinition {
        constraint_span: Option<Span>,
        constraint_symbol: Option<Identifier<'a>>,
        foreign_key_span: Span,
        index_name: Option<Identifier<'a>>,
        cols: Vec<IndexCol<'a>>,
        references_span: Span,
        references_table: Identifier<'a>,
        references_cols: Vec<Identifier<'a>>,
        match_type: Option<ForeignKeyMatch>,
        ons: Vec<ForeignKeyOn>,
    },
    CheckConstraintDefinition {
        constraint_span: Option<Span>,
        constraint_symbol: Option<Identifier<'a>>,
        check_span: Span,
        expression: Expression<'a>,
        enforced: Option<(bool, Span)>,
    },
}
Expand description

Definition in create table

Variants§

§

ColumnDefinition

Fields

§identifier: Identifier<'a>

Name of column

§data_type: DataType<'a>

Datatype and options for column

§

IndexDefinition

Index definition (PRIMARY KEY, UNIQUE, INDEX, KEY, FULLTEXT, SPATIAL)

Fields

§constraint_span: Option<Span>

Optional “CONSTRAINT” span

§constraint_symbol: Option<Identifier<'a>>

Optional constraint symbol

§index_type: IndexType

The type of index

§index_name: Option<Identifier<'a>>

Optional index name

§cols: Vec<IndexCol<'a>>

Columns in the index

§index_options: Vec<IndexOption<'a>>

Index options

§

ForeignKeyDefinition

Foreign key definition

Fields

§constraint_span: Option<Span>

Optional “CONSTRAINT” span

§constraint_symbol: Option<Identifier<'a>>

Optional constraint symbol

§foreign_key_span: Span

Span of “FOREIGN KEY”

§index_name: Option<Identifier<'a>>

Optional index name

§cols: Vec<IndexCol<'a>>

Columns in this table

§references_span: Span

Span of “REFERENCES”

§references_table: Identifier<'a>

Referenced table name

§references_cols: Vec<Identifier<'a>>

Referenced columns

§match_type: Option<ForeignKeyMatch>

Optional MATCH FULL / MATCH SIMPLE / MATCH PARTIAL

§ons: Vec<ForeignKeyOn>

ON UPDATE/DELETE actions

§

CheckConstraintDefinition

Check constraint definition

Fields

§constraint_span: Option<Span>

Optional “CONSTRAINT” span

§constraint_symbol: Option<Identifier<'a>>

Optional constraint symbol

§check_span: Span

Span of “CHECK”

§expression: Expression<'a>

Check expression

§enforced: Option<(bool, Span)>

Optional ENFORCED/NOT ENFORCED

Trait Implementations§

Source§

impl<'a> Clone for CreateDefinition<'a>

Source§

fn clone(&self) -> CreateDefinition<'a>

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<'a> Debug for CreateDefinition<'a>

Source§

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

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

impl<'a> Spanned for CreateDefinition<'a>

Source§

fn span(&self) -> Span

Compute byte span of an ast fragment
Source§

fn join_span(&self, other: &impl OptSpanned) -> Span

Compute the minimal span containing both self and other

Auto Trait Implementations§

§

impl<'a> Freeze for CreateDefinition<'a>

§

impl<'a> RefUnwindSafe for CreateDefinition<'a>

§

impl<'a> Send for CreateDefinition<'a>

§

impl<'a> Sync for CreateDefinition<'a>

§

impl<'a> Unpin for CreateDefinition<'a>

§

impl<'a> UnsafeUnpin for CreateDefinition<'a>

§

impl<'a> UnwindSafe for CreateDefinition<'a>

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> OptSpanned for T
where T: Spanned,

Source§

fn opt_span(&self) -> Option<Range<usize>>

Compute an optional byte span of an ast fragment
Source§

fn opt_join_span(&self, other: &impl OptSpanned) -> Option<Span>

Compute the minimal span containing both self and other if either is missing return the other
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, 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.