From 01b8861aad4db9a10fc3412533356c9398cdaea7 Mon Sep 17 00:00:00 2001 From: frectonz Date: Fri, 14 Jun 2024 23:04:43 +0300 Subject: [PATCH] feat: add a column count field --- src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.rs b/src/main.rs index 75cbbba..f1de67b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -315,12 +315,16 @@ impl TheDB { index_count }; + let mut columns = conn.prepare(&format!("PRAGMA table_info({name})"))?; + let column_count = columns.query_map((), |r| r.get::<_, String>(1))?.count() as i32; + color_eyre::eyre::Ok(responses::Table { name, sql, row_count, table_size, index_count, + column_count, }) }) .await? @@ -474,6 +478,7 @@ mod responses { pub sql: String, pub row_count: i32, pub index_count: i32, + pub column_count: i32, pub table_size: String, }