pub struct ColumnDef {Show 14 fields
pub name: String,
pub ty: ColumnType,
pub primary_key: bool,
pub not_null: bool,
pub not_null_explicit: bool,
pub not_null_name: Option<String>,
pub auto_increment: bool,
pub unique: bool,
pub default: Option<Expr>,
pub generated: Option<GeneratedColumn>,
pub check: Option<Expr>,
pub check_name: Option<String>,
pub check_enforced: bool,
pub references: Option<ForeignKeyRef>,
}Fields§
§name: String§ty: ColumnType§primary_key: bool§not_null: bool§not_null_explicit: boolWhether NOT NULL was declared as its own constraint instead of being
implied by PRIMARY KEY or an auto-incrementing identity.
not_null_name: Option<String>Durable PostgreSQL 18 NOT NULL constraint name. Parsing leaves an
unnamed declaration as None; table registration assigns and persists
PostgreSQL’s generated name before the constraint becomes visible.
auto_increment: boolSERIAL / BIGSERIAL columns auto-allocate from a per-table
monotonic counter when the value is omitted from INSERT.
unique: boolUNIQUE column constraint – the engine rejects an INSERT
whose value for this column already exists in another row.
default: Option<Expr>DEFAULT <expr>. Evaluated at INSERT time when the column is
not present in the row tuple. Persisted in catalog metadata so
reopened engines keep the same INSERT semantics.
generated: Option<GeneratedColumn>PostgreSQL 18 generated-column definition. Stored values are refreshed
on every row write; virtual values are evaluated from the physical row
only when a logical row is read.
check: Option<Expr>CHECK (<expr>) column-level constraint. Evaluated at INSERT
(and UPDATE-replace) time against the row being written.
check_name: Option<String>§check_enforced: bool§references: Option<ForeignKeyRef>REFERENCES parent(col) column-level FOREIGN KEY. The engine
rejects INSERT / UPDATE whose value is not present in the
referenced (table, column) pair.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ColumnDef
impl<'de> Deserialize<'de> for ColumnDef
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>,
Auto Trait Implementations§
impl Freeze for ColumnDef
impl RefUnwindSafe for ColumnDef
impl Send for ColumnDef
impl Sync for ColumnDef
impl Unpin for ColumnDef
impl UnsafeUnpin for ColumnDef
impl UnwindSafe for ColumnDef
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
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