user.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Code generated by entc, DO NOT EDIT.
  2. package user
  3. const (
  4. // Label holds the string label denoting the user type in the database.
  5. Label = "user"
  6. // FieldID holds the string denoting the id field in the database.
  7. FieldID = "id"
  8. // FieldAge holds the string denoting the age field in the database.
  9. FieldAge = "age"
  10. // FieldName holds the string denoting the name field in the database.
  11. FieldName = "name"
  12. // EdgeCars holds the string denoting the cars edge name in mutations.
  13. EdgeCars = "cars"
  14. // EdgeGroups holds the string denoting the groups edge name in mutations.
  15. EdgeGroups = "groups"
  16. // Table holds the table name of the user in the database.
  17. Table = "users"
  18. // CarsTable is the table that holds the cars relation/edge.
  19. CarsTable = "cars"
  20. // CarsInverseTable is the table name for the Car entity.
  21. // It exists in this package in order to avoid circular dependency with the "car" package.
  22. CarsInverseTable = "cars"
  23. // CarsColumn is the table column denoting the cars relation/edge.
  24. CarsColumn = "user_cars"
  25. // GroupsTable is the table that holds the groups relation/edge. The primary key declared below.
  26. GroupsTable = "group_users"
  27. // GroupsInverseTable is the table name for the Group entity.
  28. // It exists in this package in order to avoid circular dependency with the "group" package.
  29. GroupsInverseTable = "groups"
  30. )
  31. // Columns holds all SQL columns for user fields.
  32. var Columns = []string{
  33. FieldID,
  34. FieldAge,
  35. FieldName,
  36. }
  37. var (
  38. // GroupsPrimaryKey and GroupsColumn2 are the table columns denoting the
  39. // primary key for the groups relation (M2M).
  40. GroupsPrimaryKey = []string{"group_id", "user_id"}
  41. )
  42. // ValidColumn reports if the column name is valid (part of the table columns).
  43. func ValidColumn(column string) bool {
  44. for i := range Columns {
  45. if column == Columns[i] {
  46. return true
  47. }
  48. }
  49. return false
  50. }
  51. var (
  52. // AgeValidator is a validator for the "age" field. It is called by the builders before save.
  53. AgeValidator func(int) error
  54. // DefaultName holds the default value on creation for the "name" field.
  55. DefaultName string
  56. )