runtime.go 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. // Code generated by entc, DO NOT EDIT.
  2. package ent
  3. import (
  4. "code.osinet.fr/fgm/go__ent_demo/ent/group"
  5. "code.osinet.fr/fgm/go__ent_demo/ent/schema"
  6. "code.osinet.fr/fgm/go__ent_demo/ent/user"
  7. )
  8. // The init function reads all schema descriptors with runtime code
  9. // (default values, validators, hooks and policies) and stitches it
  10. // to their package variables.
  11. func init() {
  12. groupFields := schema.Group{}.Fields()
  13. _ = groupFields
  14. // groupDescName is the schema descriptor for name field.
  15. groupDescName := groupFields[0].Descriptor()
  16. // group.NameValidator is a validator for the "name" field. It is called by the builders before save.
  17. group.NameValidator = groupDescName.Validators[0].(func(string) error)
  18. userFields := schema.User{}.Fields()
  19. _ = userFields
  20. // userDescAge is the schema descriptor for age field.
  21. userDescAge := userFields[0].Descriptor()
  22. // user.AgeValidator is a validator for the "age" field. It is called by the builders before save.
  23. user.AgeValidator = userDescAge.Validators[0].(func(int) error)
  24. // userDescName is the schema descriptor for name field.
  25. userDescName := userFields[1].Descriptor()
  26. // user.DefaultName holds the default value on creation for the name field.
  27. user.DefaultName = userDescName.Default.(string)
  28. }