This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtime.go
55 lines (50 loc) · 2.02 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
// Code generated by ent, DO NOT EDIT.
package runtime
import (
"time"
"github.com/shopspring/decimal"
"github.com/woocoos/entco/integration/gentest/ent/schema"
"github.com/woocoos/entco/integration/gentest/ent/user"
)
// 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() {
userMixin := schema.User{}.Mixin()
userMixinHooks0 := userMixin[0].Hooks()
user.Hooks[0] = userMixinHooks0[0]
userFields := schema.User{}.Fields()
_ = userFields
// userDescName is the schema descriptor for name field.
userDescName := userFields[0].Descriptor()
// user.NameValidator is a validator for the "name" field. It is called by the builders before save.
user.NameValidator = userDescName.Validators[0].(func(string) error)
// userDescCreatedAt is the schema descriptor for created_at field.
userDescCreatedAt := userFields[1].Descriptor()
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
user.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)
// userDescMoney is the schema descriptor for money field.
userDescMoney := userFields[2].Descriptor()
// user.DefaultMoney holds the default value on creation for the money field.
user.DefaultMoney = userDescMoney.Default.(func() decimal.Decimal)
// user.MoneyValidator is a validator for the "money" field. It is called by the builders before save.
user.MoneyValidator = func() func(decimal.Decimal) error {
validators := userDescMoney.Validators
fns := [...]func(decimal.Decimal) error{
validators[0].(func(decimal.Decimal) error),
validators[1].(func(decimal.Decimal) error),
}
return func(money decimal.Decimal) error {
for _, fn := range fns {
if err := fn(money); err != nil {
return err
}
}
return nil
}
}()
}
const (
Version = "v0.12.4" // Version of ent codegen.
Sum = "h1:LddPnAyxls/O7DTXZvUGDj0NZIdGSu317+aoNLJWbD8=" // Sum of ent codegen.
)