pub struct KoreSchema {
pub current_version: SchemaVersion,
pub columns: Vec<SchemaField>,
pub column_index: HashMap<String, usize>,
pub aliases: HashMap<String, String>,
pub history: Vec<SchemaHistoryEntry>,
pub deleted_columns: BTreeMap<String, SchemaField>,
pub type_conversions: HashMap<String, TypeConversionRule>,
}Expand description
Complete schema at a specific version
Fields§
§current_version: SchemaVersionCurrent version number
columns: Vec<SchemaField>Active (non-deleted) columns
column_index: HashMap<String, usize>Map from column name to column index
aliases: HashMap<String, String>Column name aliases (old_name → new_name)
history: Vec<SchemaHistoryEntry>Complete history of all changes
deleted_columns: BTreeMap<String, SchemaField>Deleted columns (for recovery)
type_conversions: HashMap<String, TypeConversionRule>Type conversion registry
Implementations§
Source§impl KoreSchema
impl KoreSchema
Sourcepub fn get_column(&self, name: &str) -> Option<&SchemaField>
pub fn get_column(&self, name: &str) -> Option<&SchemaField>
Get a column by name (handles aliases)
Sourcepub fn add_column(
&mut self,
name: String,
column_type: KType,
nullable: bool,
default_value: Option<KVal>,
author: String,
reason: String,
) -> Result<(), String>
pub fn add_column( &mut self, name: String, column_type: KType, nullable: bool, default_value: Option<KVal>, author: String, reason: String, ) -> Result<(), String>
Add a new column
Sourcepub fn remove_column(
&mut self,
name: &str,
author: String,
reason: String,
) -> Result<(), String>
pub fn remove_column( &mut self, name: &str, author: String, reason: String, ) -> Result<(), String>
Remove a column (lazy deletion - mark as deleted)
Sourcepub fn rename_column(
&mut self,
old_name: &str,
new_name: &str,
author: String,
reason: String,
) -> Result<(), String>
pub fn rename_column( &mut self, old_name: &str, new_name: &str, author: String, reason: String, ) -> Result<(), String>
Rename a column (maintains backward compatibility via aliases)
Sourcepub fn change_type(
&mut self,
column_name: &str,
new_type: KType,
conversion_rule: TypeConversionRule,
author: String,
reason: String,
) -> Result<(), String>
pub fn change_type( &mut self, column_name: &str, new_type: KType, conversion_rule: TypeConversionRule, author: String, reason: String, ) -> Result<(), String>
Evolve a column’s type
Sourcepub fn set_nullable(
&mut self,
column_name: &str,
nullable: bool,
author: String,
reason: String,
) -> Result<(), String>
pub fn set_nullable( &mut self, column_name: &str, nullable: bool, author: String, reason: String, ) -> Result<(), String>
Modify column nullability
Sourcepub fn active_columns(&self) -> Vec<&SchemaField>
pub fn active_columns(&self) -> Vec<&SchemaField>
Get all active (non-deleted) columns
Sourcepub fn num_active_columns(&self) -> usize
pub fn num_active_columns(&self) -> usize
Get number of active columns
Sourcepub fn has_column(&self, name: &str) -> bool
pub fn has_column(&self, name: &str) -> bool
Check if a column exists and is active
Sourcepub fn get_history(&self) -> &[SchemaHistoryEntry]
pub fn get_history(&self) -> &[SchemaHistoryEntry]
Get the history of changes
Sourcepub fn get_schema_at_version(
&self,
target_version: SchemaVersion,
) -> Result<KoreSchema, String>
pub fn get_schema_at_version( &self, target_version: SchemaVersion, ) -> Result<KoreSchema, String>
Get schema at a specific version (reconstruct from history)
Sourcepub fn is_backward_compatible(&self) -> bool
pub fn is_backward_compatible(&self) -> bool
Validate backward compatibility: can old readers read new data?
Sourcepub fn is_forward_compatible(&self) -> bool
pub fn is_forward_compatible(&self) -> bool
Validate forward compatibility: can new readers read old data?
Trait Implementations§
Source§impl Clone for KoreSchema
impl Clone for KoreSchema
Source§fn clone(&self) -> KoreSchema
fn clone(&self) -> KoreSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more