userattributedefinition.go 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. // Code generated by ent, DO NOT EDIT.
  2. package userattributedefinition
  3. import (
  4. "time"
  5. "entgo.io/ent"
  6. "entgo.io/ent/dialect/sql"
  7. "entgo.io/ent/dialect/sql/sqlgraph"
  8. )
  9. const (
  10. // Label holds the string label denoting the userattributedefinition type in the database.
  11. Label = "user_attribute_definition"
  12. // FieldID holds the string denoting the id field in the database.
  13. FieldID = "id"
  14. // FieldCreatedAt holds the string denoting the created_at field in the database.
  15. FieldCreatedAt = "created_at"
  16. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  17. FieldUpdatedAt = "updated_at"
  18. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  19. FieldDeletedAt = "deleted_at"
  20. // FieldKey holds the string denoting the key field in the database.
  21. FieldKey = "key"
  22. // FieldName holds the string denoting the name field in the database.
  23. FieldName = "name"
  24. // FieldDescription holds the string denoting the description field in the database.
  25. FieldDescription = "description"
  26. // FieldType holds the string denoting the type field in the database.
  27. FieldType = "type"
  28. // FieldOptions holds the string denoting the options field in the database.
  29. FieldOptions = "options"
  30. // FieldRequired holds the string denoting the required field in the database.
  31. FieldRequired = "required"
  32. // FieldValidation holds the string denoting the validation field in the database.
  33. FieldValidation = "validation"
  34. // FieldPlaceholder holds the string denoting the placeholder field in the database.
  35. FieldPlaceholder = "placeholder"
  36. // FieldDisplayOrder holds the string denoting the display_order field in the database.
  37. FieldDisplayOrder = "display_order"
  38. // FieldEnabled holds the string denoting the enabled field in the database.
  39. FieldEnabled = "enabled"
  40. // EdgeValues holds the string denoting the values edge name in mutations.
  41. EdgeValues = "values"
  42. // Table holds the table name of the userattributedefinition in the database.
  43. Table = "user_attribute_definitions"
  44. // ValuesTable is the table that holds the values relation/edge.
  45. ValuesTable = "user_attribute_values"
  46. // ValuesInverseTable is the table name for the UserAttributeValue entity.
  47. // It exists in this package in order to avoid circular dependency with the "userattributevalue" package.
  48. ValuesInverseTable = "user_attribute_values"
  49. // ValuesColumn is the table column denoting the values relation/edge.
  50. ValuesColumn = "attribute_id"
  51. )
  52. // Columns holds all SQL columns for userattributedefinition fields.
  53. var Columns = []string{
  54. FieldID,
  55. FieldCreatedAt,
  56. FieldUpdatedAt,
  57. FieldDeletedAt,
  58. FieldKey,
  59. FieldName,
  60. FieldDescription,
  61. FieldType,
  62. FieldOptions,
  63. FieldRequired,
  64. FieldValidation,
  65. FieldPlaceholder,
  66. FieldDisplayOrder,
  67. FieldEnabled,
  68. }
  69. // ValidColumn reports if the column name is valid (part of the table columns).
  70. func ValidColumn(column string) bool {
  71. for i := range Columns {
  72. if column == Columns[i] {
  73. return true
  74. }
  75. }
  76. return false
  77. }
  78. // Note that the variables below are initialized by the runtime
  79. // package on the initialization of the application. Therefore,
  80. // it should be imported in the main as follows:
  81. //
  82. // import _ "github.com/Wei-Shaw/sub2api/ent/runtime"
  83. var (
  84. Hooks [1]ent.Hook
  85. Interceptors [1]ent.Interceptor
  86. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  87. DefaultCreatedAt func() time.Time
  88. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  89. DefaultUpdatedAt func() time.Time
  90. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  91. UpdateDefaultUpdatedAt func() time.Time
  92. // KeyValidator is a validator for the "key" field. It is called by the builders before save.
  93. KeyValidator func(string) error
  94. // NameValidator is a validator for the "name" field. It is called by the builders before save.
  95. NameValidator func(string) error
  96. // DefaultDescription holds the default value on creation for the "description" field.
  97. DefaultDescription string
  98. // TypeValidator is a validator for the "type" field. It is called by the builders before save.
  99. TypeValidator func(string) error
  100. // DefaultOptions holds the default value on creation for the "options" field.
  101. DefaultOptions []map[string]interface{}
  102. // DefaultRequired holds the default value on creation for the "required" field.
  103. DefaultRequired bool
  104. // DefaultValidation holds the default value on creation for the "validation" field.
  105. DefaultValidation map[string]interface{}
  106. // DefaultPlaceholder holds the default value on creation for the "placeholder" field.
  107. DefaultPlaceholder string
  108. // PlaceholderValidator is a validator for the "placeholder" field. It is called by the builders before save.
  109. PlaceholderValidator func(string) error
  110. // DefaultDisplayOrder holds the default value on creation for the "display_order" field.
  111. DefaultDisplayOrder int
  112. // DefaultEnabled holds the default value on creation for the "enabled" field.
  113. DefaultEnabled bool
  114. )
  115. // OrderOption defines the ordering options for the UserAttributeDefinition queries.
  116. type OrderOption func(*sql.Selector)
  117. // ByID orders the results by the id field.
  118. func ByID(opts ...sql.OrderTermOption) OrderOption {
  119. return sql.OrderByField(FieldID, opts...).ToFunc()
  120. }
  121. // ByCreatedAt orders the results by the created_at field.
  122. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  123. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  124. }
  125. // ByUpdatedAt orders the results by the updated_at field.
  126. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  127. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  128. }
  129. // ByDeletedAt orders the results by the deleted_at field.
  130. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  131. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  132. }
  133. // ByKey orders the results by the key field.
  134. func ByKey(opts ...sql.OrderTermOption) OrderOption {
  135. return sql.OrderByField(FieldKey, opts...).ToFunc()
  136. }
  137. // ByName orders the results by the name field.
  138. func ByName(opts ...sql.OrderTermOption) OrderOption {
  139. return sql.OrderByField(FieldName, opts...).ToFunc()
  140. }
  141. // ByDescription orders the results by the description field.
  142. func ByDescription(opts ...sql.OrderTermOption) OrderOption {
  143. return sql.OrderByField(FieldDescription, opts...).ToFunc()
  144. }
  145. // ByType orders the results by the type field.
  146. func ByType(opts ...sql.OrderTermOption) OrderOption {
  147. return sql.OrderByField(FieldType, opts...).ToFunc()
  148. }
  149. // ByRequired orders the results by the required field.
  150. func ByRequired(opts ...sql.OrderTermOption) OrderOption {
  151. return sql.OrderByField(FieldRequired, opts...).ToFunc()
  152. }
  153. // ByPlaceholder orders the results by the placeholder field.
  154. func ByPlaceholder(opts ...sql.OrderTermOption) OrderOption {
  155. return sql.OrderByField(FieldPlaceholder, opts...).ToFunc()
  156. }
  157. // ByDisplayOrder orders the results by the display_order field.
  158. func ByDisplayOrder(opts ...sql.OrderTermOption) OrderOption {
  159. return sql.OrderByField(FieldDisplayOrder, opts...).ToFunc()
  160. }
  161. // ByEnabled orders the results by the enabled field.
  162. func ByEnabled(opts ...sql.OrderTermOption) OrderOption {
  163. return sql.OrderByField(FieldEnabled, opts...).ToFunc()
  164. }
  165. // ByValuesCount orders the results by values count.
  166. func ByValuesCount(opts ...sql.OrderTermOption) OrderOption {
  167. return func(s *sql.Selector) {
  168. sqlgraph.OrderByNeighborsCount(s, newValuesStep(), opts...)
  169. }
  170. }
  171. // ByValues orders the results by values terms.
  172. func ByValues(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  173. return func(s *sql.Selector) {
  174. sqlgraph.OrderByNeighborTerms(s, newValuesStep(), append([]sql.OrderTerm{term}, terms...)...)
  175. }
  176. }
  177. func newValuesStep() *sqlgraph.Step {
  178. return sqlgraph.NewStep(
  179. sqlgraph.From(Table, FieldID),
  180. sqlgraph.To(ValuesInverseTable, FieldID),
  181. sqlgraph.Edge(sqlgraph.O2M, false, ValuesTable, ValuesColumn),
  182. )
  183. }