Expand description
Catalog module for the Alopex SQL dialect.
This module provides metadata management for tables and indexes.
§Components
TableMetadata: Table schema informationColumnMetadata: Column schema informationIndexMetadata: Index schema informationCatalog: Trait for catalog implementationsMemoryCatalog: In-memory catalog implementation
§Example
use alopex_sql::catalog::{Catalog, MemoryCatalog, TableMetadata, ColumnMetadata, IndexMetadata};
use alopex_sql::planner::types::ResolvedType;
use alopex_sql::ast::ddl::IndexMethod;
// Create an in-memory catalog
let mut catalog = MemoryCatalog::new();
// Create a table
let columns = vec![
ColumnMetadata::new("id", ResolvedType::Integer).with_primary_key(true),
ColumnMetadata::new("name", ResolvedType::Text).with_not_null(true),
];
let table = TableMetadata::new("users", columns);
catalog.create_table(table).unwrap();
// Check table existence
assert!(catalog.table_exists("users"));
assert!(catalog.get_table("users").is_some());
// Create an index (index_id is assigned by catalog in production)
let index = IndexMetadata::new(1, "idx_users_name", "users", vec!["name".into()])
.with_method(IndexMethod::BTree);
catalog.create_index(index).unwrap();
// Query indexes
assert!(catalog.index_exists("idx_users_name"));
assert_eq!(catalog.get_indexes_for_table("users").len(), 1);Re-exports§
pub use persistent::TxnCatalogView;pub use persistent::CatalogError;pub use persistent::CatalogOverlay;pub use persistent::PersistentCatalog;
Modules§
- persistent
- 永続化対応カタログ実装。
Structs§
- Column
Metadata - Metadata for a column in a table.
- Index
Metadata - Metadata for an index in the catalog.
- Memory
Catalog - In-memory catalog implementation using HashMaps.
- Storage
Options - Configurable storage options for a table.
- Table
Metadata - Metadata for a table in the catalog.
Enums§
- Compression
- Compression codec used for stored data.
- RowId
Mode - RowID materialization mode for columnar tables.
- Storage
Type - Storage layout for a table.
Traits§
- Catalog
- Trait for catalog implementations.