runtime.go 1.1 KB

1234567891011121314151617181920212223242526272829
  1. // Code generated by entc, DO NOT EDIT.
  2. package ent
  3. import (
  4. "time"
  5. "todo/ent/schema"
  6. "todo/ent/todo"
  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. todoFields := schema.Todo{}.Fields()
  13. _ = todoFields
  14. // todoDescText is the schema descriptor for text field.
  15. todoDescText := todoFields[0].Descriptor()
  16. // todo.TextValidator is a validator for the "text" field. It is called by the builders before save.
  17. todo.TextValidator = todoDescText.Validators[0].(func(string) error)
  18. // todoDescCreatedAt is the schema descriptor for created_at field.
  19. todoDescCreatedAt := todoFields[1].Descriptor()
  20. // todo.DefaultCreatedAt holds the default value on creation for the created_at field.
  21. todo.DefaultCreatedAt = todoDescCreatedAt.Default.(func() time.Time)
  22. // todoDescPriority is the schema descriptor for priority field.
  23. todoDescPriority := todoFields[3].Descriptor()
  24. // todo.DefaultPriority holds the default value on creation for the priority field.
  25. todo.DefaultPriority = todoDescPriority.Default.(int)
  26. }