-
Notifications
You must be signed in to change notification settings - Fork 38
/
workflowstage.go
243 lines (218 loc) · 8.8 KB
/
workflowstage.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
// SPDX-FileCopyrightText: 2024 Seal, Inc
// SPDX-License-Identifier: Apache-2.0
// Code generated by "walrus". DO NOT EDIT.
package workflowstage
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"golang.org/x/exp/slices"
"github.com/seal-io/walrus/pkg/dao/types/object"
)
const (
// Label holds the string label denoting the workflowstage type in the database.
Label = "workflow_stage"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldLabels holds the string denoting the labels field in the database.
FieldLabels = "labels"
// FieldAnnotations holds the string denoting the annotations field in the database.
FieldAnnotations = "annotations"
// FieldCreateTime holds the string denoting the create_time field in the database.
FieldCreateTime = "create_time"
// FieldUpdateTime holds the string denoting the update_time field in the database.
FieldUpdateTime = "update_time"
// FieldProjectID holds the string denoting the project_id field in the database.
FieldProjectID = "project_id"
// FieldWorkflowID holds the string denoting the workflow_id field in the database.
FieldWorkflowID = "workflow_id"
// FieldDependencies holds the string denoting the dependencies field in the database.
FieldDependencies = "dependencies"
// FieldOrder holds the string denoting the order field in the database.
FieldOrder = "order"
// EdgeProject holds the string denoting the project edge name in mutations.
EdgeProject = "project"
// EdgeSteps holds the string denoting the steps edge name in mutations.
EdgeSteps = "steps"
// EdgeWorkflow holds the string denoting the workflow edge name in mutations.
EdgeWorkflow = "workflow"
// Table holds the table name of the workflowstage in the database.
Table = "workflow_stages"
// ProjectTable is the table that holds the project relation/edge.
ProjectTable = "workflow_stages"
// ProjectInverseTable is the table name for the Project entity.
// It exists in this package in order to avoid circular dependency with the "project" package.
ProjectInverseTable = "projects"
// ProjectColumn is the table column denoting the project relation/edge.
ProjectColumn = "project_id"
// StepsTable is the table that holds the steps relation/edge.
StepsTable = "workflow_steps"
// StepsInverseTable is the table name for the WorkflowStep entity.
// It exists in this package in order to avoid circular dependency with the "workflowstep" package.
StepsInverseTable = "workflow_steps"
// StepsColumn is the table column denoting the steps relation/edge.
StepsColumn = "workflow_stage_id"
// WorkflowTable is the table that holds the workflow relation/edge.
WorkflowTable = "workflow_stages"
// WorkflowInverseTable is the table name for the Workflow entity.
// It exists in this package in order to avoid circular dependency with the "workflow" package.
WorkflowInverseTable = "workflows"
// WorkflowColumn is the table column denoting the workflow relation/edge.
WorkflowColumn = "workflow_id"
)
// Columns holds all SQL columns for workflowstage fields.
var Columns = []string{
FieldID,
FieldName,
FieldDescription,
FieldLabels,
FieldAnnotations,
FieldCreateTime,
FieldUpdateTime,
FieldProjectID,
FieldWorkflowID,
FieldDependencies,
FieldOrder,
}
// 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
}
}
return false
}
// Note that the variables below are initialized by the runtime
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
// import _ "github.com/seal-io/walrus/pkg/dao/model/runtime"
var (
Hooks [1]ent.Hook
Interceptors [1]ent.Interceptor
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
// DefaultLabels holds the default value on creation for the "labels" field.
DefaultLabels map[string]string
// DefaultAnnotations holds the default value on creation for the "annotations" field.
DefaultAnnotations map[string]string
// DefaultCreateTime holds the default value on creation for the "create_time" field.
DefaultCreateTime func() time.Time
// DefaultUpdateTime holds the default value on creation for the "update_time" field.
DefaultUpdateTime func() time.Time
// UpdateDefaultUpdateTime holds the default value on update for the "update_time" field.
UpdateDefaultUpdateTime func() time.Time
// ProjectIDValidator is a validator for the "project_id" field. It is called by the builders before save.
ProjectIDValidator func(string) error
// WorkflowIDValidator is a validator for the "workflow_id" field. It is called by the builders before save.
WorkflowIDValidator func(string) error
// DefaultDependencies holds the default value on creation for the "dependencies" field.
DefaultDependencies []object.ID
// DefaultOrder holds the default value on creation for the "order" field.
DefaultOrder int
// OrderValidator is a validator for the "order" field. It is called by the builders before save.
OrderValidator func(int) error
)
// OrderOption defines the ordering options for the WorkflowStage queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByCreateTime orders the results by the create_time field.
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
}
// ByUpdateTime orders the results by the update_time field.
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
}
// ByProjectID orders the results by the project_id field.
func ByProjectID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldProjectID, opts...).ToFunc()
}
// ByWorkflowID orders the results by the workflow_id field.
func ByWorkflowID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldWorkflowID, opts...).ToFunc()
}
// ByOrder orders the results by the order field.
func ByOrder(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOrder, opts...).ToFunc()
}
// ByProjectField orders the results by project field.
func ByProjectField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newProjectStep(), sql.OrderByField(field, opts...))
}
}
// ByStepsCount orders the results by steps count.
func ByStepsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newStepsStep(), opts...)
}
}
// BySteps orders the results by steps terms.
func BySteps(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newStepsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByWorkflowField orders the results by workflow field.
func ByWorkflowField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newWorkflowStep(), sql.OrderByField(field, opts...))
}
}
func newProjectStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ProjectInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, ProjectTable, ProjectColumn),
)
}
func newStepsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(StepsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, StepsTable, StepsColumn),
)
}
func newWorkflowStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(WorkflowInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, WorkflowTable, WorkflowColumn),
)
}
// WithoutFields returns the fields ignored the given list.
func WithoutFields(ignores ...string) []string {
if len(ignores) == 0 {
return slices.Clone(Columns)
}
var s = make(map[string]bool, len(ignores))
for i := range ignores {
s[ignores[i]] = true
}
var r = make([]string, 0, len(Columns)-len(s))
for i := range Columns {
if s[Columns[i]] {
continue
}
r = append(r, Columns[i])
}
return r
}