pub struct ColumnDef {
pub schema: &'static str,
pub table: &'static str,
pub name: &'static str,
pub sql_type: &'static str,
pub type_schema: Option<&'static str>,
pub not_null: bool,
pub default: Option<&'static str>,
pub generated: Option<GeneratedDef>,
pub identity: Option<IdentityDef>,
pub dimensions: Option<i32>,
}Expand description
Const-friendly column definition for compile-time schema definitions.
Fields§
§schema: &'static strSchema name
table: &'static strParent table name
name: &'static strColumn name
sql_type: &'static strSQL type (e.g., “INTEGER”, “TEXT”, “VARCHAR”)
type_schema: Option<&'static str>Type schema (for custom types)
not_null: boolIs this column NOT NULL?
default: Option<&'static str>Default value as string (if any)
generated: Option<GeneratedDef>Generated column configuration
identity: Option<IdentityDef>Identity column configuration
dimensions: Option<i32>Array dimensions (for array types)
Implementations§
Source§impl ColumnDef
impl ColumnDef
Sourcepub const fn new(
schema: &'static str,
table: &'static str,
name: &'static str,
sql_type: &'static str,
) -> Self
pub const fn new( schema: &'static str, table: &'static str, name: &'static str, sql_type: &'static str, ) -> Self
Create a new column definition
Sourcepub const fn type_schema(self, schema: &'static str) -> Self
pub const fn type_schema(self, schema: &'static str) -> Self
Set type schema (for custom types)
Sourcepub const fn default_value(self, value: &'static str) -> Self
pub const fn default_value(self, value: &'static str) -> Self
Set default value
Sourcepub const fn generated_stored(self, expression: &'static str) -> Self
pub const fn generated_stored(self, expression: &'static str) -> Self
Set as generated stored column
Sourcepub const fn identity(self, identity: IdentityDef) -> Self
pub const fn identity(self, identity: IdentityDef) -> Self
Set as identity column
Sourcepub const fn dimensions(self, dims: i32) -> Self
pub const fn dimensions(self, dims: i32) -> Self
Set array dimensions
Sourcepub const fn into_column(self) -> Column
pub const fn into_column(self) -> Column
Convert to runtime Column type
Note: This method cannot be const because it needs to convert nested Option types (generated and identity) which require runtime method calls.
Trait Implementations§
impl Copy for ColumnDef
impl Eq for ColumnDef
impl StructuralPartialEq for ColumnDef
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