Expand description
Table info panel for single-table detail display.
Displays comprehensive information about a single database table, including
columns, indexes, foreign keys, and optional statistics. Complementary to
SchemaTree - while SchemaTree shows the
overview, TableInfo shows detailed information for one table.
§Example
use sqlmodel_console::renderables::{TableInfo, TableStats, ColumnData, IndexData, ForeignKeyData};
let columns = vec![
ColumnData {
name: "id".to_string(),
sql_type: "BIGINT".to_string(),
nullable: false,
default: None,
primary_key: true,
auto_increment: true,
},
ColumnData {
name: "name".to_string(),
sql_type: "VARCHAR(255)".to_string(),
nullable: false,
default: None,
primary_key: false,
auto_increment: false,
},
];
let table_info = TableInfo::new("heroes", columns)
.with_primary_key(vec!["id".to_string()])
.with_stats(TableStats {
row_count: Some(10_000),
size_bytes: Some(2_500_000),
..Default::default()
})
.width(80);
println!("{}", table_info.render_plain());Re-exports§
pub use super::schema_tree::ColumnData;pub use super::schema_tree::ForeignKeyData;pub use super::schema_tree::IndexData;
Structs§
- Table
Info - Table information panel for displaying detailed table structure.
- Table
Stats - Optional runtime statistics for a table.
Functions§
- format_
bytes - Format bytes as human-readable size (KB, MB, GB).
- format_
number - Format a number with thousand separators.