1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-16 18:01:37 +00:00

feat: show size of DB on the about page

This commit is contained in:
Paul Stenius 2025-03-03 20:08:01 -05:00
parent ad02f21d04
commit 173ec497a2
22 changed files with 175 additions and 135 deletions

View file

@ -42,3 +42,15 @@ func (s *Storage) Ping() error {
func (s *Storage) DBStats() sql.DBStats {
return s.db.Stats()
}
// DBSize returns how much size the database is using in a pretty way.
func (s *Storage) DBSize() (string, error) {
var size string
err := s.db.QueryRow("SELECT pg_size_pretty(pg_database_size(current_database()))").Scan(&size)
if err != nil {
return "", err
}
return size, nil
}