rawdb: replace tablewriter usage with manual formatted output

This commit is contained in:
Tinu280 2025-11-19 15:21:41 +07:00
parent 115526e608
commit 177c86ef83

View file

@ -650,11 +650,21 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte) error {
total.Add(uint64(ancient.size())) total.Add(uint64(ancient.size()))
} }
table := NewTableWriter(os.Stdout) // Print header
table.SetHeader([]string{"Database", "Category", "Size", "Items"}) fmt.Println("Database\tCategory\tSize\tItems")
table.SetFooter([]string{"", "Total", common.StorageSize(total.Load()).String(), fmt.Sprintf("%d", count.Load())})
table.AppendBulk(stats) // Print table rows (stats is [][]string)
table.Render() for _, row := range stats {
if len(row) == 4 {
fmt.Printf("%s\t%s\t%s\t%s\n", row[0], row[1], row[2], row[3])
}
}
// Print footer summary
fmt.Printf("\nTotal\t\t%s\t%d\n",
common.StorageSize(total.Load()).String(),
count.Load(),
)
if !unaccounted.empty() { if !unaccounted.empty() {
log.Error("Database contains unaccounted data", "size", unaccounted.sizeString(), "count", unaccounted.countString()) log.Error("Database contains unaccounted data", "size", unaccounted.sizeString(), "count", unaccounted.countString())