Skip to content

Commit

Permalink
fix: 统计数据库排除自带的
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Oct 26, 2023
1 parent 8b1e817 commit e975d0e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/http/controllers/info_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ func (c *InfoController) CountInfo(ctx http.Context) http.Response {
if err != nil {
continue
}
if d.Name == "information_schema" || d.Name == "performance_schema" || d.Name == "mysql" || d.Name == "sys" {
continue
}

databases = append(databases, d)
}
Expand All @@ -156,7 +159,7 @@ func (c *InfoController) CountInfo(ctx http.Context) http.Response {
databases = databases[3 : len(databases)-1]
for _, db := range databases {
parts := strings.Split(db, "|")
if len(parts) != 9 || len(strings.TrimSpace(parts[0])) == 0 {
if len(parts) != 9 || len(strings.TrimSpace(parts[0])) == 0 || strings.TrimSpace(parts[0]) == "template0" || strings.TrimSpace(parts[0]) == "template1" || strings.TrimSpace(parts[0]) == "postgres" {
continue
}

Expand Down

0 comments on commit e975d0e

Please sign in to comment.