-
Notifications
You must be signed in to change notification settings - Fork 12
/
runtime.go
272 lines (267 loc) · 14.4 KB
/
runtime.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
261
262
263
264
265
266
267
268
269
270
271
272
// Copyright 2023 The Infratographer Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by entc, DO NOT EDIT.
package runtime
import (
"time"
"go.infratographer.com/load-balancer-api/internal/ent/generated/loadbalancer"
"go.infratographer.com/load-balancer-api/internal/ent/generated/origin"
"go.infratographer.com/load-balancer-api/internal/ent/generated/pool"
"go.infratographer.com/load-balancer-api/internal/ent/generated/port"
"go.infratographer.com/load-balancer-api/internal/ent/generated/provider"
"go.infratographer.com/load-balancer-api/internal/ent/schema"
"go.infratographer.com/x/gidx"
)
// The init function reads all schema descriptors with runtime code
// (default values, validators, hooks and policies) and stitches it
// to their package variables.
func init() {
loadbalancerMixin := schema.LoadBalancer{}.Mixin()
loadbalancerMixinHooks1 := loadbalancerMixin[1].Hooks()
loadbalancerMixinHooks2 := loadbalancerMixin[2].Hooks()
loadbalancer.Hooks[0] = loadbalancerMixinHooks1[0]
loadbalancer.Hooks[1] = loadbalancerMixinHooks2[0]
loadbalancerMixinInters2 := loadbalancerMixin[2].Interceptors()
loadbalancer.Interceptors[0] = loadbalancerMixinInters2[0]
loadbalancerMixinFields0 := loadbalancerMixin[0].Fields()
_ = loadbalancerMixinFields0
loadbalancerFields := schema.LoadBalancer{}.Fields()
_ = loadbalancerFields
// loadbalancerDescCreatedAt is the schema descriptor for created_at field.
loadbalancerDescCreatedAt := loadbalancerMixinFields0[0].Descriptor()
// loadbalancer.DefaultCreatedAt holds the default value on creation for the created_at field.
loadbalancer.DefaultCreatedAt = loadbalancerDescCreatedAt.Default.(func() time.Time)
// loadbalancerDescUpdatedAt is the schema descriptor for updated_at field.
loadbalancerDescUpdatedAt := loadbalancerMixinFields0[1].Descriptor()
// loadbalancer.DefaultUpdatedAt holds the default value on creation for the updated_at field.
loadbalancer.DefaultUpdatedAt = loadbalancerDescUpdatedAt.Default.(func() time.Time)
// loadbalancer.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
loadbalancer.UpdateDefaultUpdatedAt = loadbalancerDescUpdatedAt.UpdateDefault.(func() time.Time)
// loadbalancerDescName is the schema descriptor for name field.
loadbalancerDescName := loadbalancerFields[1].Descriptor()
// loadbalancer.NameValidator is a validator for the "name" field. It is called by the builders before save.
loadbalancer.NameValidator = loadbalancerDescName.Validators[0].(func(string) error)
// loadbalancerDescOwnerID is the schema descriptor for owner_id field.
loadbalancerDescOwnerID := loadbalancerFields[2].Descriptor()
// loadbalancer.OwnerIDValidator is a validator for the "owner_id" field. It is called by the builders before save.
loadbalancer.OwnerIDValidator = loadbalancerDescOwnerID.Validators[0].(func(string) error)
// loadbalancerDescLocationID is the schema descriptor for location_id field.
loadbalancerDescLocationID := loadbalancerFields[3].Descriptor()
// loadbalancer.LocationIDValidator is a validator for the "location_id" field. It is called by the builders before save.
loadbalancer.LocationIDValidator = loadbalancerDescLocationID.Validators[0].(func(string) error)
// loadbalancerDescProviderID is the schema descriptor for provider_id field.
loadbalancerDescProviderID := loadbalancerFields[4].Descriptor()
// loadbalancer.ProviderIDValidator is a validator for the "provider_id" field. It is called by the builders before save.
loadbalancer.ProviderIDValidator = loadbalancerDescProviderID.Validators[0].(func(string) error)
// loadbalancerDescID is the schema descriptor for id field.
loadbalancerDescID := loadbalancerFields[0].Descriptor()
// loadbalancer.DefaultID holds the default value on creation for the id field.
loadbalancer.DefaultID = loadbalancerDescID.Default.(func() gidx.PrefixedID)
originMixin := schema.Origin{}.Mixin()
originMixinHooks1 := originMixin[1].Hooks()
originMixinHooks2 := originMixin[2].Hooks()
origin.Hooks[0] = originMixinHooks1[0]
origin.Hooks[1] = originMixinHooks2[0]
originMixinInters1 := originMixin[1].Interceptors()
origin.Interceptors[0] = originMixinInters1[0]
originMixinFields0 := originMixin[0].Fields()
_ = originMixinFields0
originFields := schema.Origin{}.Fields()
_ = originFields
// originDescCreatedAt is the schema descriptor for created_at field.
originDescCreatedAt := originMixinFields0[0].Descriptor()
// origin.DefaultCreatedAt holds the default value on creation for the created_at field.
origin.DefaultCreatedAt = originDescCreatedAt.Default.(func() time.Time)
// originDescUpdatedAt is the schema descriptor for updated_at field.
originDescUpdatedAt := originMixinFields0[1].Descriptor()
// origin.DefaultUpdatedAt holds the default value on creation for the updated_at field.
origin.DefaultUpdatedAt = originDescUpdatedAt.Default.(func() time.Time)
// origin.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
origin.UpdateDefaultUpdatedAt = originDescUpdatedAt.UpdateDefault.(func() time.Time)
// originDescName is the schema descriptor for name field.
originDescName := originFields[1].Descriptor()
// origin.NameValidator is a validator for the "name" field. It is called by the builders before save.
origin.NameValidator = originDescName.Validators[0].(func(string) error)
// originDescWeight is the schema descriptor for weight field.
originDescWeight := originFields[2].Descriptor()
// origin.DefaultWeight holds the default value on creation for the weight field.
origin.DefaultWeight = originDescWeight.Default.(int32)
// originDescTarget is the schema descriptor for target field.
originDescTarget := originFields[3].Descriptor()
// origin.TargetValidator is a validator for the "target" field. It is called by the builders before save.
origin.TargetValidator = func() func(string) error {
validators := originDescTarget.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(target string) error {
for _, fn := range fns {
if err := fn(target); err != nil {
return err
}
}
return nil
}
}()
// originDescPortNumber is the schema descriptor for port_number field.
originDescPortNumber := originFields[4].Descriptor()
// origin.PortNumberValidator is a validator for the "port_number" field. It is called by the builders before save.
origin.PortNumberValidator = func() func(int) error {
validators := originDescPortNumber.Validators
fns := [...]func(int) error{
validators[0].(func(int) error),
validators[1].(func(int) error),
}
return func(port_number int) error {
for _, fn := range fns {
if err := fn(port_number); err != nil {
return err
}
}
return nil
}
}()
// originDescActive is the schema descriptor for active field.
originDescActive := originFields[5].Descriptor()
// origin.DefaultActive holds the default value on creation for the active field.
origin.DefaultActive = originDescActive.Default.(bool)
// originDescPoolID is the schema descriptor for pool_id field.
originDescPoolID := originFields[6].Descriptor()
// origin.PoolIDValidator is a validator for the "pool_id" field. It is called by the builders before save.
origin.PoolIDValidator = originDescPoolID.Validators[0].(func(string) error)
// originDescID is the schema descriptor for id field.
originDescID := originFields[0].Descriptor()
// origin.DefaultID holds the default value on creation for the id field.
origin.DefaultID = originDescID.Default.(func() gidx.PrefixedID)
poolMixin := schema.Pool{}.Mixin()
poolMixinHooks1 := poolMixin[1].Hooks()
poolMixinHooks2 := poolMixin[2].Hooks()
pool.Hooks[0] = poolMixinHooks1[0]
pool.Hooks[1] = poolMixinHooks2[0]
poolMixinInters2 := poolMixin[2].Interceptors()
pool.Interceptors[0] = poolMixinInters2[0]
poolMixinFields0 := poolMixin[0].Fields()
_ = poolMixinFields0
poolFields := schema.Pool{}.Fields()
_ = poolFields
// poolDescCreatedAt is the schema descriptor for created_at field.
poolDescCreatedAt := poolMixinFields0[0].Descriptor()
// pool.DefaultCreatedAt holds the default value on creation for the created_at field.
pool.DefaultCreatedAt = poolDescCreatedAt.Default.(func() time.Time)
// poolDescUpdatedAt is the schema descriptor for updated_at field.
poolDescUpdatedAt := poolMixinFields0[1].Descriptor()
// pool.DefaultUpdatedAt holds the default value on creation for the updated_at field.
pool.DefaultUpdatedAt = poolDescUpdatedAt.Default.(func() time.Time)
// pool.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
pool.UpdateDefaultUpdatedAt = poolDescUpdatedAt.UpdateDefault.(func() time.Time)
// poolDescName is the schema descriptor for name field.
poolDescName := poolFields[1].Descriptor()
// pool.NameValidator is a validator for the "name" field. It is called by the builders before save.
pool.NameValidator = poolDescName.Validators[0].(func(string) error)
// poolDescOwnerID is the schema descriptor for owner_id field.
poolDescOwnerID := poolFields[3].Descriptor()
// pool.OwnerIDValidator is a validator for the "owner_id" field. It is called by the builders before save.
pool.OwnerIDValidator = poolDescOwnerID.Validators[0].(func(string) error)
// poolDescID is the schema descriptor for id field.
poolDescID := poolFields[0].Descriptor()
// pool.DefaultID holds the default value on creation for the id field.
pool.DefaultID = poolDescID.Default.(func() gidx.PrefixedID)
portMixin := schema.Port{}.Mixin()
portMixinHooks1 := portMixin[1].Hooks()
portMixinHooks2 := portMixin[2].Hooks()
port.Hooks[0] = portMixinHooks1[0]
port.Hooks[1] = portMixinHooks2[0]
portMixinInters1 := portMixin[1].Interceptors()
port.Interceptors[0] = portMixinInters1[0]
portMixinFields0 := portMixin[0].Fields()
_ = portMixinFields0
portFields := schema.Port{}.Fields()
_ = portFields
// portDescCreatedAt is the schema descriptor for created_at field.
portDescCreatedAt := portMixinFields0[0].Descriptor()
// port.DefaultCreatedAt holds the default value on creation for the created_at field.
port.DefaultCreatedAt = portDescCreatedAt.Default.(func() time.Time)
// portDescUpdatedAt is the schema descriptor for updated_at field.
portDescUpdatedAt := portMixinFields0[1].Descriptor()
// port.DefaultUpdatedAt holds the default value on creation for the updated_at field.
port.DefaultUpdatedAt = portDescUpdatedAt.Default.(func() time.Time)
// port.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
port.UpdateDefaultUpdatedAt = portDescUpdatedAt.UpdateDefault.(func() time.Time)
// portDescNumber is the schema descriptor for number field.
portDescNumber := portFields[1].Descriptor()
// port.NumberValidator is a validator for the "number" field. It is called by the builders before save.
port.NumberValidator = func() func(int) error {
validators := portDescNumber.Validators
fns := [...]func(int) error{
validators[0].(func(int) error),
validators[1].(func(int) error),
validators[2].(func(int) error),
}
return func(number int) error {
for _, fn := range fns {
if err := fn(number); err != nil {
return err
}
}
return nil
}
}()
// portDescLoadBalancerID is the schema descriptor for load_balancer_id field.
portDescLoadBalancerID := portFields[3].Descriptor()
// port.LoadBalancerIDValidator is a validator for the "load_balancer_id" field. It is called by the builders before save.
port.LoadBalancerIDValidator = portDescLoadBalancerID.Validators[0].(func(string) error)
// portDescID is the schema descriptor for id field.
portDescID := portFields[0].Descriptor()
// port.DefaultID holds the default value on creation for the id field.
port.DefaultID = portDescID.Default.(func() gidx.PrefixedID)
providerMixin := schema.Provider{}.Mixin()
providerMixinHooks1 := providerMixin[1].Hooks()
providerMixinHooks2 := providerMixin[2].Hooks()
provider.Hooks[0] = providerMixinHooks1[0]
provider.Hooks[1] = providerMixinHooks2[0]
providerMixinInters1 := providerMixin[1].Interceptors()
provider.Interceptors[0] = providerMixinInters1[0]
providerMixinFields0 := providerMixin[0].Fields()
_ = providerMixinFields0
providerFields := schema.Provider{}.Fields()
_ = providerFields
// providerDescCreatedAt is the schema descriptor for created_at field.
providerDescCreatedAt := providerMixinFields0[0].Descriptor()
// provider.DefaultCreatedAt holds the default value on creation for the created_at field.
provider.DefaultCreatedAt = providerDescCreatedAt.Default.(func() time.Time)
// providerDescUpdatedAt is the schema descriptor for updated_at field.
providerDescUpdatedAt := providerMixinFields0[1].Descriptor()
// provider.DefaultUpdatedAt holds the default value on creation for the updated_at field.
provider.DefaultUpdatedAt = providerDescUpdatedAt.Default.(func() time.Time)
// provider.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
provider.UpdateDefaultUpdatedAt = providerDescUpdatedAt.UpdateDefault.(func() time.Time)
// providerDescName is the schema descriptor for name field.
providerDescName := providerFields[1].Descriptor()
// provider.NameValidator is a validator for the "name" field. It is called by the builders before save.
provider.NameValidator = providerDescName.Validators[0].(func(string) error)
// providerDescOwnerID is the schema descriptor for owner_id field.
providerDescOwnerID := providerFields[2].Descriptor()
// provider.OwnerIDValidator is a validator for the "owner_id" field. It is called by the builders before save.
provider.OwnerIDValidator = providerDescOwnerID.Validators[0].(func(string) error)
// providerDescID is the schema descriptor for id field.
providerDescID := providerFields[0].Descriptor()
// provider.DefaultID holds the default value on creation for the id field.
provider.DefaultID = providerDescID.Default.(func() gidx.PrefixedID)
}
const (
Version = "v0.12.4" // Version of ent codegen.
Sum = "h1:LddPnAyxls/O7DTXZvUGDj0NZIdGSu317+aoNLJWbD8=" // Sum of ent codegen.
)