forked from ent/contrib
/
runtime.go
34 lines (31 loc) · 1.11 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
// Code generated by ent, DO NOT EDIT.
package ent
import (
"github.com/tilau2328/entcontrib/schemast/internal/mutatetest/ent/schema"
"github.com/tilau2328/entcontrib/schemast/internal/mutatetest/ent/withmodifiedfield"
)
// 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() {
withmodifiedfieldFields := schema.WithModifiedField{}.Fields()
_ = withmodifiedfieldFields
// withmodifiedfieldDescName is the schema descriptor for name field.
withmodifiedfieldDescName := withmodifiedfieldFields[0].Descriptor()
// withmodifiedfield.NameValidator is a validator for the "name" field. It is called by the builders before save.
withmodifiedfield.NameValidator = func() func(string) error {
validators := withmodifiedfieldDescName.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(name string) error {
for _, fn := range fns {
if err := fn(name); err != nil {
return err
}
}
return nil
}
}()
}