Skip to content

Commit

Permalink
feat: add a column count field
Browse files Browse the repository at this point in the history
  • Loading branch information
frectonz committed Jun 14, 2024
1 parent e7a8eae commit 01b8861
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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,
}

Expand Down

0 comments on commit 01b8861

Please sign in to comment.