Skip to main content

Module catalog

Module catalog 

Source
Expand description

Catalog module for the Alopex SQL dialect.

This module provides metadata management for tables and indexes.

§Components

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

ColumnMetadata
Metadata for a column in a table.
IndexMetadata
Metadata for an index in the catalog.
MemoryCatalog
In-memory catalog implementation using HashMaps.
StorageOptions
Configurable storage options for a table.
TableMetadata
Metadata for a table in the catalog.

Enums§

Compression
Compression codec used for stored data.
RowIdMode
RowID materialization mode for columnar tables.
StorageType
Storage layout for a table.

Traits§

Catalog
Trait for catalog implementations.