-
Notifications
You must be signed in to change notification settings - Fork 0
/
vulnerability_dto.go
80 lines (67 loc) · 3.42 KB
/
vulnerability_dto.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package models
import "time"
type (
VulnerabilityDto struct {
Id int `gorm:"column:Id;primaryKey;<-:false"`
ExternalId string `gorm:"column:ExternalId;<-:false"`
PackageName string `gorm:"column:PackageName;<-:false"`
Version string `gorm:"column:Version;<-:false"`
Title string `gorm:"column:Title;<-:false"`
Description string `gorm:"column:Description;<-:false"`
Severity string `gorm:"column:Severity;<-:false"`
CVSS *float32 `gorm:"column:CVSS;<-:false"`
CVSSv3 string `gorm:"column:CVSSv3;<-:false"`
CreationTime time.Time `gorm:"column:CreationTime;<-:false"`
ModificationTime time.Time `gorm:"column:ModificationTime;<-:false"`
PublicationTime time.Time `gorm:"column:PublicationTime;<-:false"`
DisclosureTime time.Time `gorm:"column:DisclosureTime;<-:false"`
References []VulnerabilityReferenceDto `gorm:"foreignKey:VulnerabilityId"`
Identifiers []VulnerabilityIdentifierDto `gorm:"foreignKey:VulnerabilityId"`
}
VulnerabilityReferenceDto struct {
VulnerabilityId int `gorm:"column:VulnerabilityId;primaryKey;<-:false"`
Url string `gorm:"column:Url;primaryKey;<-:false"`
}
VulnerabilityIdentifierDto struct {
VulnerabilityId int `gorm:"column:VulnerabilityId;primaryKey;<-:false"`
IdentifierType string `gorm:"column:IdentifierType;primaryKey;<-:false"`
Identifier string `gorm:"column:Identifier;primaryKey;<-:false"`
}
ImageDto struct {
Id int `gorm:"column:Id;primaryKey;<-:false"`
Name string `gorm:"column:Name;->;<-:create"`
BaseImage string `gorm:"column:BaseImage;->;<-:create"`
Scans []ImageScanDto `gorm:"foreignKey:ImageId"`
}
ImageScanDto struct {
Id int `gorm:"column:Id;primaryKey;<-:false"`
ImageId int `gorm:"column:ImageId;<-:false"`
ScanTime time.Time `gorm:"column:ScanTime;<-:false"`
ScanSuccess bool `gorm:"column:ScanSuccess;<-:false"`
VulnerabilityAggregation []ImageScanVulnerabilityAggregation `gorm:"foreignKey:ImageScanId"`
Vulnerabilities []VulnerabilityDto `gorm:"many2many:ImageScanVulnerabilities;joinForeignKey:ImageScanId;joinReferences:VulnerabilityId"` // https://gorm.io/docs/many_to_many.html
}
ImageScanVulnerabilityAggregation struct {
ImageScanId int `gorm:"column:ImageScanId;<-:false"`
Severity string `gorm:"column:Severity;<-:false"`
Count int `gorm:"column:Count;<-:false"`
}
)
func (VulnerabilityDto) TableName() string {
return "dbo.Vulnerability"
}
func (VulnerabilityReferenceDto) TableName() string {
return "dbo.VulnerabilityReferences"
}
func (VulnerabilityIdentifierDto) TableName() string {
return "dbo.VulnerabilityIdentifiers"
}
func (ImageDto) TableName() string {
return "dbo.Image"
}
func (ImageScanDto) TableName() string {
return "dbo.ImageScan"
}
func (ImageScanVulnerabilityAggregation) TableName() string {
return "dbo.ImageScanVulnerabilityAggregation"
}