pub struct ColumnDef {
pub column_ref: ColumnRef,
pub column_type: &'static str,
pub value: Value,
pub nullable: bool,
pub default: Option<Box<dyn Expression>>,
pub primary_key: PrimaryKeyType,
pub unique: bool,
pub references: Option<ColumnRef>,
pub on_delete: Option<Action>,
pub on_update: Option<Action>,
pub passive: bool,
pub comment: &'static str,
}Expand description
Declarative specification of a table column.
Fields§
§column_ref: ColumnRefColumn identity.
column_type: &'static strExplicit SQL type override (empty => infer from value).
value: ValueValue describing column type and shape (arrays/maps/decimal precision).
nullable: boolNullability flag.
default: Option<Box<dyn Expression>>Default value (expression rendered by SqlWriter).
primary_key: PrimaryKeyTypePrimary key participation.
unique: boolUnique constraint (single column only, composite handled in the TableDef).
references: Option<ColumnRef>Foreign key target column.
on_delete: Option<Action>Action for deletes.
on_update: Option<Action>Action for updates.
passive: boolPassive columns are skipped when generating INSERT value lists (DEFAULT used).
comment: &'static strOptional human-readable comment.
Implementations§
Trait Implementations§
Source§impl Expression for ColumnDef
impl Expression for ColumnDef
Source§fn write_query(
&self,
writer: &dyn SqlWriter,
context: &mut Context,
out: &mut String,
)
fn write_query( &self, writer: &dyn SqlWriter, context: &mut Context, out: &mut String, )
Serialize the expression into the output string using the dialect writer.
Source§fn is_ordered(&self) -> bool
fn is_ordered(&self) -> bool
Whether this expression carries ordering (ASC/DESC) information.
Source§impl OpPrecedence for ColumnDef
impl OpPrecedence for ColumnDef
Source§fn precedence(&self, _writer: &dyn SqlWriter) -> i32
fn precedence(&self, _writer: &dyn SqlWriter) -> i32
Lower numbers bind weaker; writers parenthesize when child precedence <= operator precedence.
Auto Trait Implementations§
impl Freeze for ColumnDef
impl !RefUnwindSafe for ColumnDef
impl Send for ColumnDef
impl Sync for ColumnDef
impl Unpin 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
Mutably borrows from an owned value. Read more