Skip to main content

SchemaColumn

Struct SchemaColumn 

Source
pub struct SchemaColumn {
Show 14 fields pub id: usize, pub name: String, pub data_type: DataType, pub external_type: Option<ExternalTypeRef>, pub external_type_name: Option<String>, pub nullable: bool, pub primary_key: bool, pub auto_increment: bool, pub default_expr: Option<String>, pub default_value: Option<Value>, pub check_expr: Option<String>, pub vector_dimensions: u16, pub decimal_precision: u8, pub decimal_scale: u8, /* private fields */
}
Expand description

A column definition in a table schema

Fields§

§id: usize

Unique identifier for the column (0-based index)

§name: String

Column name

§data_type: DataType

Data type of the column

§external_type: Option<ExternalTypeRef>

Stable external type identity. Built-in columns keep this empty.

§external_type_name: Option<String>

Schema-qualified SQL type name used by introspection and dump output.

§nullable: bool

Whether the column can contain NULL values

§primary_key: bool

Whether this column is part of the primary key

§auto_increment: bool

Whether this column auto-increments (generates sequential IDs for NULL values)

§default_expr: Option<String>

Default value expression as a string (to be parsed and evaluated during INSERT)

§default_value: Option<Value>

Pre-computed default value for schema evolution (used when adding column to existing rows)

§check_expr: Option<String>

CHECK constraint expression as a string (to be parsed and evaluated during INSERT)

§vector_dimensions: u16

Number of dimensions for VECTOR columns (0 = not a vector column)

§decimal_precision: u8

Declared precision for DECIMAL columns (0 = unconstrained DECIMAL).

§decimal_scale: u8

Declared scale for DECIMAL columns. This is zero when precision is zero.

Implementations§

Source§

impl SchemaColumn

Source

pub fn new( id: usize, name: impl Into<String>, data_type: DataType, nullable: bool, primary_key: bool, ) -> Self

Create a new column definition

Source

pub fn with_vector_dimensions(self, dims: u16) -> Self

Set vector dimensions (for VECTOR columns)

Source

pub fn with_decimal_parameters(self, precision: u8, scale: u8) -> Self

Set exact DECIMAL(p,s) column parameters. A precision of zero denotes the unparameterized DECIMAL domain and requires scale zero.

Source

pub fn with_external_type( self, type_ref: ExternalTypeRef, sql_name: impl Into<String>, ) -> Self

Source

pub const fn logical_type(&self) -> LogicalTypeRef

Source

pub fn formatted_data_type(&self) -> String

Render the complete declared SQL type, including durable modifiers.

Source

pub fn has_same_declared_type(&self, other: &Self) -> bool

Exact schema-level type identity used by references and descriptors.

Source

pub fn validate_declared_value(&self, value: &Value) -> Result<()>

Validate value-level modifiers that are not represented by DataType. The value is not rewritten: exact decimal payload bytes remain intact.

Source

pub fn with_constraints( id: usize, name: impl Into<String>, data_type: DataType, nullable: bool, primary_key: bool, auto_increment: bool, default_expr: Option<String>, check_expr: Option<String>, ) -> Self

Create a new column definition with all options

Source

pub fn with_default_value( id: usize, name: impl Into<String>, data_type: DataType, nullable: bool, primary_key: bool, auto_increment: bool, default_expr: Option<String>, default_value: Option<Value>, check_expr: Option<String>, ) -> Self

Create a new column definition with pre-computed default value

Source

pub fn simple(id: usize, name: impl Into<String>, data_type: DataType) -> Self

Create a simple non-nullable, non-primary-key column

Source

pub fn nullable(id: usize, name: impl Into<String>, data_type: DataType) -> Self

Create a nullable column

Source

pub fn primary_key( id: usize, name: impl Into<String>, data_type: DataType, ) -> Self

Create a primary key column

Trait Implementations§

Source§

impl Clone for SchemaColumn

Source§

fn clone(&self) -> SchemaColumn

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SchemaColumn

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for SchemaColumn

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for SchemaColumn

Source§

impl PartialEq for SchemaColumn

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SchemaColumn

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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
Source§

impl<T> CompactArcDrop for T

Source§

unsafe fn drop_and_dealloc(ptr: *mut u8)

Drop the contained data and deallocate the header+data allocation. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

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

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V