userattributevalue.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // Code generated by ent, DO NOT EDIT.
  2. package userattributevalue
  3. import (
  4. "time"
  5. "entgo.io/ent/dialect/sql"
  6. "entgo.io/ent/dialect/sql/sqlgraph"
  7. )
  8. const (
  9. // Label holds the string label denoting the userattributevalue type in the database.
  10. Label = "user_attribute_value"
  11. // FieldID holds the string denoting the id field in the database.
  12. FieldID = "id"
  13. // FieldCreatedAt holds the string denoting the created_at field in the database.
  14. FieldCreatedAt = "created_at"
  15. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  16. FieldUpdatedAt = "updated_at"
  17. // FieldUserID holds the string denoting the user_id field in the database.
  18. FieldUserID = "user_id"
  19. // FieldAttributeID holds the string denoting the attribute_id field in the database.
  20. FieldAttributeID = "attribute_id"
  21. // FieldValue holds the string denoting the value field in the database.
  22. FieldValue = "value"
  23. // EdgeUser holds the string denoting the user edge name in mutations.
  24. EdgeUser = "user"
  25. // EdgeDefinition holds the string denoting the definition edge name in mutations.
  26. EdgeDefinition = "definition"
  27. // Table holds the table name of the userattributevalue in the database.
  28. Table = "user_attribute_values"
  29. // UserTable is the table that holds the user relation/edge.
  30. UserTable = "user_attribute_values"
  31. // UserInverseTable is the table name for the User entity.
  32. // It exists in this package in order to avoid circular dependency with the "user" package.
  33. UserInverseTable = "users"
  34. // UserColumn is the table column denoting the user relation/edge.
  35. UserColumn = "user_id"
  36. // DefinitionTable is the table that holds the definition relation/edge.
  37. DefinitionTable = "user_attribute_values"
  38. // DefinitionInverseTable is the table name for the UserAttributeDefinition entity.
  39. // It exists in this package in order to avoid circular dependency with the "userattributedefinition" package.
  40. DefinitionInverseTable = "user_attribute_definitions"
  41. // DefinitionColumn is the table column denoting the definition relation/edge.
  42. DefinitionColumn = "attribute_id"
  43. )
  44. // Columns holds all SQL columns for userattributevalue fields.
  45. var Columns = []string{
  46. FieldID,
  47. FieldCreatedAt,
  48. FieldUpdatedAt,
  49. FieldUserID,
  50. FieldAttributeID,
  51. FieldValue,
  52. }
  53. // ValidColumn reports if the column name is valid (part of the table columns).
  54. func ValidColumn(column string) bool {
  55. for i := range Columns {
  56. if column == Columns[i] {
  57. return true
  58. }
  59. }
  60. return false
  61. }
  62. var (
  63. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  64. DefaultCreatedAt func() time.Time
  65. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  66. DefaultUpdatedAt func() time.Time
  67. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  68. UpdateDefaultUpdatedAt func() time.Time
  69. // DefaultValue holds the default value on creation for the "value" field.
  70. DefaultValue string
  71. )
  72. // OrderOption defines the ordering options for the UserAttributeValue queries.
  73. type OrderOption func(*sql.Selector)
  74. // ByID orders the results by the id field.
  75. func ByID(opts ...sql.OrderTermOption) OrderOption {
  76. return sql.OrderByField(FieldID, opts...).ToFunc()
  77. }
  78. // ByCreatedAt orders the results by the created_at field.
  79. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  80. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  81. }
  82. // ByUpdatedAt orders the results by the updated_at field.
  83. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  84. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  85. }
  86. // ByUserID orders the results by the user_id field.
  87. func ByUserID(opts ...sql.OrderTermOption) OrderOption {
  88. return sql.OrderByField(FieldUserID, opts...).ToFunc()
  89. }
  90. // ByAttributeID orders the results by the attribute_id field.
  91. func ByAttributeID(opts ...sql.OrderTermOption) OrderOption {
  92. return sql.OrderByField(FieldAttributeID, opts...).ToFunc()
  93. }
  94. // ByValue orders the results by the value field.
  95. func ByValue(opts ...sql.OrderTermOption) OrderOption {
  96. return sql.OrderByField(FieldValue, opts...).ToFunc()
  97. }
  98. // ByUserField orders the results by user field.
  99. func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
  100. return func(s *sql.Selector) {
  101. sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
  102. }
  103. }
  104. // ByDefinitionField orders the results by definition field.
  105. func ByDefinitionField(field string, opts ...sql.OrderTermOption) OrderOption {
  106. return func(s *sql.Selector) {
  107. sqlgraph.OrderByNeighborTerms(s, newDefinitionStep(), sql.OrderByField(field, opts...))
  108. }
  109. }
  110. func newUserStep() *sqlgraph.Step {
  111. return sqlgraph.NewStep(
  112. sqlgraph.From(Table, FieldID),
  113. sqlgraph.To(UserInverseTable, FieldID),
  114. sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
  115. )
  116. }
  117. func newDefinitionStep() *sqlgraph.Step {
  118. return sqlgraph.NewStep(
  119. sqlgraph.From(Table, FieldID),
  120. sqlgraph.To(DefinitionInverseTable, FieldID),
  121. sqlgraph.Edge(sqlgraph.M2O, true, DefinitionTable, DefinitionColumn),
  122. )
  123. }