This repository has been archived by the owner on Mar 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
component.go
114 lines (107 loc) · 4.68 KB
/
component.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Code generated by entc, DO NOT EDIT.
package component
const (
// Label holds the string label denoting the component type in the database.
Label = "component"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldScheme holds the string denoting the scheme field in the database.
FieldScheme = "scheme"
// FieldNamespace holds the string denoting the namespace field in the database.
FieldNamespace = "namespace"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldVersion holds the string denoting the version field in the database.
FieldVersion = "version"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldURL holds the string denoting the url field in the database.
FieldURL = "url"
// FieldMetadata holds the string denoting the metadata field in the database.
FieldMetadata = "metadata"
// FieldLabels holds the string denoting the labels field in the database.
FieldLabels = "labels"
// EdgeOwner holds the string denoting the owner edge name in mutations.
EdgeOwner = "owner"
// EdgeVulnerabilities holds the string denoting the vulnerabilities edge name in mutations.
EdgeVulnerabilities = "vulnerabilities"
// EdgeLicenses holds the string denoting the licenses edge name in mutations.
EdgeLicenses = "licenses"
// EdgeUses holds the string denoting the uses edge name in mutations.
EdgeUses = "uses"
// Table holds the table name of the component in the database.
Table = "component"
// OwnerTable is the table that holds the owner relation/edge.
OwnerTable = "component"
// OwnerInverseTable is the table name for the Organization entity.
// It exists in this package in order to avoid circular dependency with the "organization" package.
OwnerInverseTable = "organization"
// OwnerColumn is the table column denoting the owner relation/edge.
OwnerColumn = "component_owner"
// VulnerabilitiesTable is the table that holds the vulnerabilities relation/edge. The primary key declared below.
VulnerabilitiesTable = "component_vulnerabilities"
// VulnerabilitiesInverseTable is the table name for the Vulnerability entity.
// It exists in this package in order to avoid circular dependency with the "vulnerability" package.
VulnerabilitiesInverseTable = "vulnerability"
// LicensesTable is the table that holds the licenses relation/edge. The primary key declared below.
LicensesTable = "component_licenses"
// LicensesInverseTable is the table name for the License entity.
// It exists in this package in order to avoid circular dependency with the "license" package.
LicensesInverseTable = "license"
// UsesTable is the table that holds the uses relation/edge.
UsesTable = "release_component"
// UsesInverseTable is the table name for the ReleaseComponent entity.
// It exists in this package in order to avoid circular dependency with the "releasecomponent" package.
UsesInverseTable = "release_component"
// UsesColumn is the table column denoting the uses relation/edge.
UsesColumn = "release_component_component"
)
// Columns holds all SQL columns for component fields.
var Columns = []string{
FieldID,
FieldScheme,
FieldNamespace,
FieldName,
FieldVersion,
FieldDescription,
FieldURL,
FieldMetadata,
FieldLabels,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "component"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"component_owner",
}
var (
// VulnerabilitiesPrimaryKey and VulnerabilitiesColumn2 are the table columns denoting the
// primary key for the vulnerabilities relation (M2M).
VulnerabilitiesPrimaryKey = []string{"component_id", "vulnerability_id"}
// LicensesPrimaryKey and LicensesColumn2 are the table columns denoting the
// primary key for the licenses relation (M2M).
LicensesPrimaryKey = []string{"component_id", "license_id"}
)
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
}
var (
// SchemeValidator is a validator for the "scheme" field. It is called by the builders before save.
SchemeValidator func(string) error
// DefaultNamespace holds the default value on creation for the "namespace" field.
DefaultNamespace string
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
// VersionValidator is a validator for the "version" field. It is called by the builders before save.
VersionValidator func(string) error
)