label.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. // Code generated by ent, DO NOT EDIT.
  2. package label
  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 label type in the database.
  11. Label = "label"
  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. // FieldStatus holds the string denoting the status field in the database.
  19. FieldStatus = "status"
  20. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  21. FieldDeletedAt = "deleted_at"
  22. // FieldType holds the string denoting the type field in the database.
  23. FieldType = "type"
  24. // FieldName holds the string denoting the name field in the database.
  25. FieldName = "name"
  26. // FieldFrom holds the string denoting the from field in the database.
  27. FieldFrom = "from"
  28. // FieldMode holds the string denoting the mode field in the database.
  29. FieldMode = "mode"
  30. // FieldConditions holds the string denoting the conditions field in the database.
  31. FieldConditions = "conditions"
  32. // EdgeLabelRelationships holds the string denoting the label_relationships edge name in mutations.
  33. EdgeLabelRelationships = "label_relationships"
  34. // Table holds the table name of the label in the database.
  35. Table = "label"
  36. // LabelRelationshipsTable is the table that holds the label_relationships relation/edge.
  37. LabelRelationshipsTable = "label_relationship"
  38. // LabelRelationshipsInverseTable is the table name for the LabelRelationship entity.
  39. // It exists in this package in order to avoid circular dependency with the "labelrelationship" package.
  40. LabelRelationshipsInverseTable = "label_relationship"
  41. // LabelRelationshipsColumn is the table column denoting the label_relationships relation/edge.
  42. LabelRelationshipsColumn = "label_id"
  43. )
  44. // Columns holds all SQL columns for label fields.
  45. var Columns = []string{
  46. FieldID,
  47. FieldCreatedAt,
  48. FieldUpdatedAt,
  49. FieldStatus,
  50. FieldDeletedAt,
  51. FieldType,
  52. FieldName,
  53. FieldFrom,
  54. FieldMode,
  55. FieldConditions,
  56. }
  57. // ValidColumn reports if the column name is valid (part of the table columns).
  58. func ValidColumn(column string) bool {
  59. for i := range Columns {
  60. if column == Columns[i] {
  61. return true
  62. }
  63. }
  64. return false
  65. }
  66. // Note that the variables below are initialized by the runtime
  67. // package on the initialization of the application. Therefore,
  68. // it should be imported in the main as follows:
  69. //
  70. // import _ "wechat-api/ent/runtime"
  71. var (
  72. Hooks [1]ent.Hook
  73. Interceptors [1]ent.Interceptor
  74. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  75. DefaultCreatedAt func() time.Time
  76. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  77. DefaultUpdatedAt func() time.Time
  78. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  79. UpdateDefaultUpdatedAt func() time.Time
  80. // DefaultStatus holds the default value on creation for the "status" field.
  81. DefaultStatus uint8
  82. // DefaultType holds the default value on creation for the "type" field.
  83. DefaultType int
  84. // DefaultName holds the default value on creation for the "name" field.
  85. DefaultName string
  86. // DefaultFrom holds the default value on creation for the "from" field.
  87. DefaultFrom int
  88. // DefaultMode holds the default value on creation for the "mode" field.
  89. DefaultMode int
  90. // DefaultConditions holds the default value on creation for the "conditions" field.
  91. DefaultConditions string
  92. )
  93. // OrderOption defines the ordering options for the Label queries.
  94. type OrderOption func(*sql.Selector)
  95. // ByID orders the results by the id field.
  96. func ByID(opts ...sql.OrderTermOption) OrderOption {
  97. return sql.OrderByField(FieldID, opts...).ToFunc()
  98. }
  99. // ByCreatedAt orders the results by the created_at field.
  100. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  101. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  102. }
  103. // ByUpdatedAt orders the results by the updated_at field.
  104. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  105. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  106. }
  107. // ByStatus orders the results by the status field.
  108. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  109. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  110. }
  111. // ByDeletedAt orders the results by the deleted_at field.
  112. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  113. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  114. }
  115. // ByType orders the results by the type field.
  116. func ByType(opts ...sql.OrderTermOption) OrderOption {
  117. return sql.OrderByField(FieldType, opts...).ToFunc()
  118. }
  119. // ByName orders the results by the name field.
  120. func ByName(opts ...sql.OrderTermOption) OrderOption {
  121. return sql.OrderByField(FieldName, opts...).ToFunc()
  122. }
  123. // ByFrom orders the results by the from field.
  124. func ByFrom(opts ...sql.OrderTermOption) OrderOption {
  125. return sql.OrderByField(FieldFrom, opts...).ToFunc()
  126. }
  127. // ByMode orders the results by the mode field.
  128. func ByMode(opts ...sql.OrderTermOption) OrderOption {
  129. return sql.OrderByField(FieldMode, opts...).ToFunc()
  130. }
  131. // ByConditions orders the results by the conditions field.
  132. func ByConditions(opts ...sql.OrderTermOption) OrderOption {
  133. return sql.OrderByField(FieldConditions, opts...).ToFunc()
  134. }
  135. // ByLabelRelationshipsCount orders the results by label_relationships count.
  136. func ByLabelRelationshipsCount(opts ...sql.OrderTermOption) OrderOption {
  137. return func(s *sql.Selector) {
  138. sqlgraph.OrderByNeighborsCount(s, newLabelRelationshipsStep(), opts...)
  139. }
  140. }
  141. // ByLabelRelationships orders the results by label_relationships terms.
  142. func ByLabelRelationships(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  143. return func(s *sql.Selector) {
  144. sqlgraph.OrderByNeighborTerms(s, newLabelRelationshipsStep(), append([]sql.OrderTerm{term}, terms...)...)
  145. }
  146. }
  147. func newLabelRelationshipsStep() *sqlgraph.Step {
  148. return sqlgraph.NewStep(
  149. sqlgraph.From(Table, FieldID),
  150. sqlgraph.To(LabelRelationshipsInverseTable, FieldID),
  151. sqlgraph.Edge(sqlgraph.O2M, false, LabelRelationshipsTable, LabelRelationshipsColumn),
  152. )
  153. }