Skip to content

Commit

Permalink
Added support for GORM in vacuum report.
Browse files Browse the repository at this point in the history
Allows the summary to be used seamlessly with GORM, no dependencies added.
  • Loading branch information
daveshanley committed Dec 22, 2022
1 parent b736bb0 commit f223067
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions model/reports/statistics.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
package reports

import (
"time"
)

// ReportStatistics represents statistics for an individual specification report.
type ReportStatistics struct {
ID uint `gorm:"primaryKey" json:"-" yaml:"-"`
CreatedAt time.Time `json:"-" yaml:"-"`
UpdatedAt time.Time `json:"-" yaml:"-"`
FilesizeKB int `json:"filesizeKb,omitempty" yaml:"filesizeKb,omitempty"`
FilesizeBytes int `json:"filesizeBytes,omitempty" yaml:"filesizeBytes,omitempty"`
SpecType string `json:"specType,omitempty" yaml:"specType,omitempty"`
Expand All @@ -23,17 +30,20 @@ type ReportStatistics struct {
TotalWarnings int `json:"totalWarnings,omitempty" yaml:"totalWarnings,omitempty"`
TotalInfo int `json:"totalInfo,omitempty" yaml:"totalInfo,omitempty"`
TotalHints int `json:"totalHints,omitempty" yaml:"totalHints,omitempty"`
CategoryStatistics []*CategoryStatistic `json:"categoryStatistics,omitempty" yaml:"categoryStatistics,omitempty"`
CategoryStatistics []*CategoryStatistic `gorm:"foreignKey:ID" json:"categoryStatistics,omitempty" yaml:"categoryStatistics,omitempty"`
}

// CategoryStatistic represents the number of issues for a particular category
type CategoryStatistic struct {
CategoryName string `json:"categoryName" yaml:"categoryName"`
CategoryId string `json:"categoryId" yaml:"categoryId"`
NumIssues int `json:"numIssues" yaml:"numIssues"`
Score int `json:"score" yaml:"score"`
Warnings int `json:"warnings" yaml:"warnings"`
Errors int `json:"errors" yaml:"errors"`
Info int `json:"info" yaml:"info"`
Hints int `json:"hints" yaml:"hints"`
ID uint `gorm:"primaryKey" json:"-" yaml:"-"`
CreatedAt time.Time `json:"-" yaml:"-"`
UpdatedAt time.Time `json:"-" yaml:"-"`
CategoryName string `json:"categoryName" yaml:"categoryName"`
CategoryId string `json:"categoryId" yaml:"categoryId"`
NumIssues int `json:"numIssues" yaml:"numIssues"`
Score int `json:"score" yaml:"score"`
Warnings int `json:"warnings" yaml:"warnings"`
Errors int `json:"errors" yaml:"errors"`
Info int `json:"info" yaml:"info"`
Hints int `json:"hints" yaml:"hints"`
}

0 comments on commit f223067

Please sign in to comment.