pub struct Schema {
pub schema_id: u64,
pub columns: Vec<ColumnDef>,
pub indexes: Vec<IndexDef>,
pub colocation: Vec<Vec<u16>>,
pub constraints: TableConstraints,
pub clustered: bool,
}Fields§
§schema_id: u64§columns: Vec<ColumnDef>§indexes: Vec<IndexDef>§colocation: Vec<Vec<u16>>Phase 18.2: column co-location groups. Each inner Vec lists column IDs that are always accessed together. The run writer writes their pages adjacently so a scan touching those columns benefits from sequential I/O and cache locality. Empty = no co-location (default).
constraints: TableConstraintsEngine-side declarative constraints (unique / FK / check). Empty by
default — legacy and Kit-managed tables carry no engine constraints and
behave exactly as before. When non-empty, the transaction layer enforces
them authoritatively at commit (see crate::database).
clustered: boolWhen true, the table is clustered on its primary key: sorted runs are
keyed by PK bytes rather than by RowId. Defaults to false.
Implementations§
Source§impl Schema
impl Schema
pub fn column(&self, name: &str) -> Option<&ColumnDef>
pub fn primary_key(&self) -> Option<&ColumnDef>
Sourcepub fn validate_not_null(&self, columns: &[(u16, Value)]) -> Result<()>
pub fn validate_not_null(&self, columns: &[(u16, Value)]) -> Result<()>
Return an error if any column that is not marked NULLABLE is either
missing from columns or present as Value::Null. A column carrying
ColumnFlags::AUTO_INCREMENT is exempt when omitted/Null because the
engine fills it in before this check runs.
Sourcepub fn validate_auto_increment(&self) -> Result<()>
pub fn validate_auto_increment(&self) -> Result<()>
Enforce the AUTO_INCREMENT column contract: at most one such column,
and it must be a non-nullable Int64 primary key. Called at table
creation time so an invalid schema never reaches the insert path.
Sourcepub fn auto_increment_column(&self) -> Option<&ColumnDef>
pub fn auto_increment_column(&self) -> Option<&ColumnDef>
The single AUTO_INCREMENT column, if any.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
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 Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
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>,
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