ColumnDef

Struct ColumnDef 

Source
pub struct ColumnDef { /* private fields */ }
Expand description

Defines a Column for an Entity

Implementationsยง

Sourceยง

impl ColumnDef

Source

pub fn unique(self) -> Self

Marks the column as UNIQUE

Source

pub fn seaography_ignore(self) -> Self

Set Seaography ignore

Source

pub fn unique_key(self, key: &str) -> Self

This column belongs to a unique key

Source

pub fn renamed_from(self, col: &str) -> Self

This column is renamed from a previous name

Source

pub fn comment(self, v: &str) -> Self

Set column comment

Source

pub fn null(self) -> Self

Mark the column as nullable

Source

pub fn nullable(self) -> Self

Mark the column as nullable

Source

pub fn indexed(self) -> Self

Set the indexed field to true

Source

pub fn default_value<T>(self, value: T) -> Self
where T: Into<Value>,

Set the default value

Source

pub fn default<T>(self, default: T) -> Self
where T: Into<SimpleExpr>,

Set the default value or expression of a column

Source

pub fn extra(self, value: &str) -> Self

Set the extra SQL string for the column (e.g. โ€œCOLLATE NOCASEโ€)

Source

pub fn get_column_type(&self) -> &ColumnType

Get ColumnType as reference

Source

pub fn get_column_default(&self) -> Option<&SimpleExpr>

Get Option as reference

Source

pub fn is_null(&self) -> bool

Returns true if the column is nullable

Source

pub fn is_unique(&self) -> bool

Returns true if the column is unique

Source

pub fn seaography(&self) -> &SeaographyColumnAttr

Get Seaography attribute

Trait Implementationsยง

Sourceยง

impl Clone for ColumnDef

Sourceยง

fn clone(&self) -> ColumnDef

Returns a duplicate of the value. Read more
1.0.0ยง

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

Performs copy-assignment from source. Read more
Sourceยง

impl ColumnTypeTrait for ColumnDef

Sourceยง

fn def(self) -> ColumnDef

Instantiate a new ColumnDef
Sourceยง

fn get_enum_name(&self) -> Option<&DynIden>

Get the name of the enum if this is a enum column
Sourceยง

impl Debug for ColumnDef

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl PartialEq for ColumnDef

Sourceยง

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

Tests for self and other values to be equal, and is used by ==.
1.0.0ยง

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 StructuralPartialEq for ColumnDef

Auto Trait Implementationsยง

Blanket Implementationsยง

ยง

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

ยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
ยง

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

ยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
ยง

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

ยง

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

Mutably borrows from an owned value. Read more
ยง

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

ยง

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
ยง

impl<T> From<T> for T

ยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
ยง

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

ยง

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> IntoEither for T

Sourceยง

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
ยง

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

ยง

type Owned = T

The resulting type after obtaining ownership.
ยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
ยง

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

Uses borrowed data to replace owned data, usually by cloning. Read more
ยง

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

ยง

type Error = Infallible

The type returned in the event of a conversion error.
ยง

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

Performs the conversion.
ยง

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

ยง

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

The type returned in the event of a conversion error.
ยง

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

Performs the conversion.
Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more