pub struct ColumnDef {
pub name: String,
pub column_type: ColumnType,
pub nullable: bool,
pub default: Option<String>,
pub primary_key: bool,
pub modifiers: Vec<ColumnModifier>,
pub generated_expr: Option<String>,
pub generated_deps: Vec<String>,
pub added_at_version: u16,
}Expand description
A single column definition in a strict document or columnar schema.
Fields§
§name: String§column_type: ColumnType§nullable: bool§default: Option<String>§primary_key: bool§modifiers: Vec<ColumnModifier>Column-level modifiers (TIME_KEY, SPATIAL_INDEX, etc.).
generated_expr: Option<String>GENERATED ALWAYS AS expression (serialized SqlExpr JSON). When set, this column is computed at write time, not supplied by the user.
generated_deps: Vec<String>Column names this generated column depends on.
added_at_version: u16Schema version at which this column was added. Original columns have
version 1 (the default). Columns added via ALTER ADD COLUMN record
the schema version after the bump so the reader can build a physical
sub-schema for tuples written under older versions.
Implementations§
Source§impl ColumnDef
impl ColumnDef
pub fn required(name: impl Into<String>, column_type: ColumnType) -> Self
pub fn nullable(name: impl Into<String>, column_type: ColumnType) -> Self
pub fn with_primary_key(self) -> Self
Sourcepub fn is_time_key(&self) -> bool
pub fn is_time_key(&self) -> bool
Check if this column has the TIME_KEY modifier.
Sourcepub fn is_spatial_index(&self) -> bool
pub fn is_spatial_index(&self) -> bool
Check if this column has the SPATIAL_INDEX modifier.
pub fn with_default(self, expr: impl Into<String>) -> Self
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for ColumnDef
impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for ColumnDef
Source§impl ToMessagePack for ColumnDef
impl ToMessagePack 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 UnsafeUnpin for ColumnDef
impl UnwindSafe for ColumnDef
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.