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
/
releaseentry.go
135 lines (122 loc) · 4.4 KB
/
releaseentry.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// Code generated by entc, DO NOT EDIT.
package releaseentry
import (
"fmt"
"io"
"strconv"
"time"
)
const (
// Label holds the string label denoting the releaseentry type in the database.
Label = "release_entry"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldType holds the string denoting the type field in the database.
FieldType = "type"
// FieldTime holds the string denoting the time field in the database.
FieldTime = "time"
// EdgeArtifact holds the string denoting the artifact edge name in mutations.
EdgeArtifact = "artifact"
// EdgeCodeScan holds the string denoting the code_scan edge name in mutations.
EdgeCodeScan = "code_scan"
// EdgeTestRun holds the string denoting the test_run edge name in mutations.
EdgeTestRun = "test_run"
// EdgeRelease holds the string denoting the release edge name in mutations.
EdgeRelease = "release"
// Table holds the table name of the releaseentry in the database.
Table = "release_entry"
// ArtifactTable is the table that holds the artifact relation/edge.
ArtifactTable = "artifact"
// ArtifactInverseTable is the table name for the Artifact entity.
// It exists in this package in order to avoid circular dependency with the "artifact" package.
ArtifactInverseTable = "artifact"
// ArtifactColumn is the table column denoting the artifact relation/edge.
ArtifactColumn = "release_entry_artifact"
// CodeScanTable is the table that holds the code_scan relation/edge.
CodeScanTable = "code_scan"
// CodeScanInverseTable is the table name for the CodeScan entity.
// It exists in this package in order to avoid circular dependency with the "codescan" package.
CodeScanInverseTable = "code_scan"
// CodeScanColumn is the table column denoting the code_scan relation/edge.
CodeScanColumn = "release_entry_code_scan"
// TestRunTable is the table that holds the test_run relation/edge.
TestRunTable = "test_run"
// TestRunInverseTable is the table name for the TestRun entity.
// It exists in this package in order to avoid circular dependency with the "testrun" package.
TestRunInverseTable = "test_run"
// TestRunColumn is the table column denoting the test_run relation/edge.
TestRunColumn = "release_entry_test_run"
// ReleaseTable is the table that holds the release relation/edge.
ReleaseTable = "release_entry"
// ReleaseInverseTable is the table name for the Release entity.
// It exists in this package in order to avoid circular dependency with the "release" package.
ReleaseInverseTable = "release"
// ReleaseColumn is the table column denoting the release relation/edge.
ReleaseColumn = "release_entry_release"
)
// Columns holds all SQL columns for releaseentry fields.
var Columns = []string{
FieldID,
FieldType,
FieldTime,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "release_entry"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"release_entry_release",
}
// 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 (
// DefaultTime holds the default value on creation for the "time" field.
DefaultTime func() time.Time
)
// Type defines the type for the "type" enum field.
type Type string
// Type values.
const (
TypeArtifact Type = "artifact"
TypeDeploy Type = "deploy"
TypeCodeScan Type = "code_scan"
TypeTestRun Type = "test_run"
)
func (_type Type) String() string {
return string(_type)
}
// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save.
func TypeValidator(_type Type) error {
switch _type {
case TypeArtifact, TypeDeploy, TypeCodeScan, TypeTestRun:
return nil
default:
return fmt.Errorf("releaseentry: invalid enum value for type field: %q", _type)
}
}
// MarshalGQL implements graphql.Marshaler interface.
func (_type Type) MarshalGQL(w io.Writer) {
io.WriteString(w, strconv.Quote(_type.String()))
}
// UnmarshalGQL implements graphql.Unmarshaler interface.
func (_type *Type) UnmarshalGQL(val interface{}) error {
str, ok := val.(string)
if !ok {
return fmt.Errorf("enum %T must be a string", val)
}
*_type = Type(str)
if err := TypeValidator(*_type); err != nil {
return fmt.Errorf("%s is not a valid Type", str)
}
return nil
}