-
Notifications
You must be signed in to change notification settings - Fork 1
/
procdef.go
260 lines (229 loc) · 9.22 KB
/
procdef.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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
// Code generated by ent, DO NOT EDIT.
package procdef
import (
"fmt"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/99designs/gqlgen/graphql"
"github.com/woocoos/entco/schemax/typex"
)
const (
// Label holds the string label denoting the procdef type in the database.
Label = "proc_def"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreatedBy holds the string denoting the created_by field in the database.
FieldCreatedBy = "created_by"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedBy holds the string denoting the updated_by field in the database.
FieldUpdatedBy = "updated_by"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldTenantID holds the string denoting the tenant_id field in the database.
FieldTenantID = "tenant_id"
// FieldDeploymentID holds the string denoting the deployment_id field in the database.
FieldDeploymentID = "deployment_id"
// FieldAppID holds the string denoting the app_id field in the database.
FieldAppID = "app_id"
// FieldCategory holds the string denoting the category field in the database.
FieldCategory = "category"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldKey holds the string denoting the key field in the database.
FieldKey = "key"
// FieldVersion holds the string denoting the version field in the database.
FieldVersion = "version"
// FieldRevision holds the string denoting the revision field in the database.
FieldRevision = "revision"
// FieldVersionTag holds the string denoting the version_tag field in the database.
FieldVersionTag = "version_tag"
// FieldResourceKey holds the string denoting the resource_key field in the database.
FieldResourceKey = "resource_key"
// FieldResourceID holds the string denoting the resource_id field in the database.
FieldResourceID = "resource_id"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// EdgeDeployment holds the string denoting the deployment edge name in mutations.
EdgeDeployment = "deployment"
// EdgeProcInstances holds the string denoting the proc_instances edge name in mutations.
EdgeProcInstances = "proc_instances"
// Table holds the table name of the procdef in the database.
Table = "act_proc_def"
// DeploymentTable is the table that holds the deployment relation/edge.
DeploymentTable = "act_proc_def"
// DeploymentInverseTable is the table name for the Deployment entity.
// It exists in this package in order to avoid circular dependency with the "deployment" package.
DeploymentInverseTable = "act_deployment"
// DeploymentColumn is the table column denoting the deployment relation/edge.
DeploymentColumn = "deployment_id"
// ProcInstancesTable is the table that holds the proc_instances relation/edge.
ProcInstancesTable = "act_proc_inst"
// ProcInstancesInverseTable is the table name for the ProcInst entity.
// It exists in this package in order to avoid circular dependency with the "procinst" package.
ProcInstancesInverseTable = "act_proc_inst"
// ProcInstancesColumn is the table column denoting the proc_instances relation/edge.
ProcInstancesColumn = "proc_def_id"
)
// Columns holds all SQL columns for procdef fields.
var Columns = []string{
FieldID,
FieldCreatedBy,
FieldCreatedAt,
FieldUpdatedBy,
FieldUpdatedAt,
FieldTenantID,
FieldDeploymentID,
FieldAppID,
FieldCategory,
FieldName,
FieldKey,
FieldVersion,
FieldRevision,
FieldVersionTag,
FieldResourceKey,
FieldResourceID,
FieldStatus,
}
// 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/woocoos/workflow/ent/runtime"
var (
Hooks [3]ent.Hook
Interceptors [1]ent.Interceptor
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() int
)
const DefaultStatus typex.SimpleStatus = "active"
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
func StatusValidator(s typex.SimpleStatus) error {
switch s.String() {
case "active", "inactive", "processing":
return nil
default:
return fmt.Errorf("procdef: invalid enum value for status field: %q", s)
}
}
// OrderOption defines the ordering options for the ProcDef 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()
}
// ByCreatedBy orders the results by the created_by field.
func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedBy orders the results by the updated_by field.
func ByUpdatedBy(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedBy, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByTenantID orders the results by the tenant_id field.
func ByTenantID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTenantID, opts...).ToFunc()
}
// ByDeploymentID orders the results by the deployment_id field.
func ByDeploymentID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeploymentID, opts...).ToFunc()
}
// ByAppID orders the results by the app_id field.
func ByAppID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAppID, opts...).ToFunc()
}
// ByCategory orders the results by the category field.
func ByCategory(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCategory, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByKey orders the results by the key field.
func ByKey(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldKey, opts...).ToFunc()
}
// ByVersion orders the results by the version field.
func ByVersion(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVersion, opts...).ToFunc()
}
// ByRevision orders the results by the revision field.
func ByRevision(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRevision, opts...).ToFunc()
}
// ByVersionTag orders the results by the version_tag field.
func ByVersionTag(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVersionTag, opts...).ToFunc()
}
// ByResourceKey orders the results by the resource_key field.
func ByResourceKey(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldResourceKey, opts...).ToFunc()
}
// ByResourceID orders the results by the resource_id field.
func ByResourceID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldResourceID, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByDeploymentField orders the results by deployment field.
func ByDeploymentField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newDeploymentStep(), sql.OrderByField(field, opts...))
}
}
// ByProcInstancesCount orders the results by proc_instances count.
func ByProcInstancesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newProcInstancesStep(), opts...)
}
}
// ByProcInstances orders the results by proc_instances terms.
func ByProcInstances(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newProcInstancesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newDeploymentStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(DeploymentInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, DeploymentTable, DeploymentColumn),
)
}
func newProcInstancesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ProcInstancesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, ProcInstancesTable, ProcInstancesColumn),
)
}
var (
// typex.SimpleStatus must implement graphql.Marshaler.
_ graphql.Marshaler = (*typex.SimpleStatus)(nil)
// typex.SimpleStatus must implement graphql.Unmarshaler.
_ graphql.Unmarshaler = (*typex.SimpleStatus)(nil)
)