pub struct TableSchema {
pub keyspace: String,
pub table: String,
pub partition_keys: Vec<KeyColumn>,
pub clustering_keys: Vec<ClusteringColumn>,
pub columns: Vec<Column>,
pub comments: HashMap<String, String>,
}Expand description
Table schema definition loaded from JSON
Fields§
§keyspace: StringKeyspace name
table: StringTable name
partition_keys: Vec<KeyColumn>Partition key columns (ordered)
clustering_keys: Vec<ClusteringColumn>Clustering key columns (ordered)
columns: Vec<Column>All columns in the table
comments: HashMap<String, String>Optional metadata
Implementations§
Source§impl TableSchema
impl TableSchema
Sourcepub fn from_sstable_header(header: &SSTableHeader) -> Result<Self>
pub fn from_sstable_header(header: &SSTableHeader) -> Result<Self>
Extract schema from SSTable header column metadata
This method constructs a TableSchema from the column information embedded in the SSTable header’s SerializationHeader.
Sourcepub fn get_column(&self, name: &str) -> Option<&Column>
pub fn get_column(&self, name: &str) -> Option<&Column>
Get column by name
Sourcepub fn is_partition_key(&self, name: &str) -> bool
pub fn is_partition_key(&self, name: &str) -> bool
Check if column is a partition key
Sourcepub fn is_clustering_key(&self, name: &str) -> bool
pub fn is_clustering_key(&self, name: &str) -> bool
Check if column is a clustering key
Sourcepub fn ordered_partition_keys(&self) -> Vec<&KeyColumn>
pub fn ordered_partition_keys(&self) -> Vec<&KeyColumn>
Get partition key columns in order
Sourcepub fn ordered_clustering_keys(&self) -> Vec<&ClusteringColumn>
pub fn ordered_clustering_keys(&self) -> Vec<&ClusteringColumn>
Get clustering key columns in order
Sourcepub fn get_column_comparator(&self, column_name: &str) -> Result<ComparatorType>
pub fn get_column_comparator(&self, column_name: &str) -> Result<ComparatorType>
Get ComparatorType for a specific column
Sourcepub fn get_all_comparators(&self) -> Result<HashMap<String, ComparatorType>>
pub fn get_all_comparators(&self) -> Result<HashMap<String, ComparatorType>>
Get ComparatorTypes for all columns
Sourcepub fn get_partition_key_comparators(&self) -> Result<Vec<ComparatorType>>
pub fn get_partition_key_comparators(&self) -> Result<Vec<ComparatorType>>
Get ComparatorTypes for partition key columns in order
Sourcepub fn get_clustering_key_comparators(&self) -> Result<Vec<ComparatorType>>
pub fn get_clustering_key_comparators(&self) -> Result<Vec<ComparatorType>>
Get ComparatorTypes for clustering key columns in order
Trait Implementations§
Source§impl Clone for TableSchema
impl Clone for TableSchema
Source§fn clone(&self) -> TableSchema
fn clone(&self) -> TableSchema
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CqlVisitor<TableSchema> for SchemaBuilderVisitor
impl CqlVisitor<TableSchema> for SchemaBuilderVisitor
fn visit_statement(&mut self, statement: &CqlStatement) -> Result<TableSchema>
fn visit_create_table(&mut self, create: &CqlCreateTable) -> Result<TableSchema>
fn visit_select(&mut self, _select: &CqlSelect) -> Result<TableSchema>
fn visit_insert(&mut self, _insert: &CqlInsert) -> Result<TableSchema>
fn visit_update(&mut self, _update: &CqlUpdate) -> Result<TableSchema>
fn visit_delete(&mut self, _delete: &CqlDelete) -> Result<TableSchema>
fn visit_drop_table(&mut self, _drop: &CqlDropTable) -> Result<TableSchema>
fn visit_create_index( &mut self, _create: &CqlCreateIndex, ) -> Result<TableSchema>
fn visit_alter_table(&mut self, _alter: &CqlAlterTable) -> Result<TableSchema>
fn visit_data_type(&mut self, _data_type: &CqlDataType) -> Result<TableSchema>
fn visit_expression( &mut self, _expression: &CqlExpression, ) -> Result<TableSchema>
fn visit_identifier( &mut self, _identifier: &CqlIdentifier, ) -> Result<TableSchema>
fn visit_literal(&mut self, _literal: &CqlLiteral) -> Result<TableSchema>
Source§impl Debug for TableSchema
impl Debug for TableSchema
Source§impl<'de> Deserialize<'de> for TableSchema
impl<'de> Deserialize<'de> for TableSchema
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
Auto Trait Implementations§
impl Freeze for TableSchema
impl RefUnwindSafe for TableSchema
impl Send for TableSchema
impl Sync for TableSchema
impl Unpin for TableSchema
impl UnsafeUnpin for TableSchema
impl UnwindSafe for TableSchema
Blanket Implementations§
impl<T> Allocation for T
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