sopnode.go 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. // Code generated by ent, DO NOT EDIT.
  2. package sopnode
  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 sopnode type in the database.
  11. Label = "sop_node"
  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. // FieldStageID holds the string denoting the stage_id field in the database.
  23. FieldStageID = "stage_id"
  24. // FieldParentID holds the string denoting the parent_id field in the database.
  25. FieldParentID = "parent_id"
  26. // FieldName holds the string denoting the name field in the database.
  27. FieldName = "name"
  28. // FieldConditionType holds the string denoting the condition_type field in the database.
  29. FieldConditionType = "condition_type"
  30. // FieldConditionList holds the string denoting the condition_list field in the database.
  31. FieldConditionList = "condition_list"
  32. // FieldNoReplyCondition holds the string denoting the no_reply_condition field in the database.
  33. FieldNoReplyCondition = "no_reply_condition"
  34. // FieldActionMessage holds the string denoting the action_message field in the database.
  35. FieldActionMessage = "action_message"
  36. // FieldActionLabel holds the string denoting the action_label field in the database.
  37. FieldActionLabel = "action_label"
  38. // FieldActionForward holds the string denoting the action_forward field in the database.
  39. FieldActionForward = "action_forward"
  40. // EdgeSopStage holds the string denoting the sop_stage edge name in mutations.
  41. EdgeSopStage = "sop_stage"
  42. // EdgeNodeMessages holds the string denoting the node_messages edge name in mutations.
  43. EdgeNodeMessages = "node_messages"
  44. // Table holds the table name of the sopnode in the database.
  45. Table = "sop_node"
  46. // SopStageTable is the table that holds the sop_stage relation/edge.
  47. SopStageTable = "sop_node"
  48. // SopStageInverseTable is the table name for the SopStage entity.
  49. // It exists in this package in order to avoid circular dependency with the "sopstage" package.
  50. SopStageInverseTable = "sop_stage"
  51. // SopStageColumn is the table column denoting the sop_stage relation/edge.
  52. SopStageColumn = "stage_id"
  53. // NodeMessagesTable is the table that holds the node_messages relation/edge.
  54. NodeMessagesTable = "message_records"
  55. // NodeMessagesInverseTable is the table name for the MessageRecords entity.
  56. // It exists in this package in order to avoid circular dependency with the "messagerecords" package.
  57. NodeMessagesInverseTable = "message_records"
  58. // NodeMessagesColumn is the table column denoting the node_messages relation/edge.
  59. NodeMessagesColumn = "sub_source_id"
  60. )
  61. // Columns holds all SQL columns for sopnode fields.
  62. var Columns = []string{
  63. FieldID,
  64. FieldCreatedAt,
  65. FieldUpdatedAt,
  66. FieldStatus,
  67. FieldDeletedAt,
  68. FieldStageID,
  69. FieldParentID,
  70. FieldName,
  71. FieldConditionType,
  72. FieldConditionList,
  73. FieldNoReplyCondition,
  74. FieldActionMessage,
  75. FieldActionLabel,
  76. FieldActionForward,
  77. }
  78. // ValidColumn reports if the column name is valid (part of the table columns).
  79. func ValidColumn(column string) bool {
  80. for i := range Columns {
  81. if column == Columns[i] {
  82. return true
  83. }
  84. }
  85. return false
  86. }
  87. // Note that the variables below are initialized by the runtime
  88. // package on the initialization of the application. Therefore,
  89. // it should be imported in the main as follows:
  90. //
  91. // import _ "wechat-api/ent/runtime"
  92. var (
  93. Hooks [1]ent.Hook
  94. Interceptors [1]ent.Interceptor
  95. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  96. DefaultCreatedAt func() time.Time
  97. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  98. DefaultUpdatedAt func() time.Time
  99. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  100. UpdateDefaultUpdatedAt func() time.Time
  101. // DefaultStatus holds the default value on creation for the "status" field.
  102. DefaultStatus uint8
  103. // DefaultName holds the default value on creation for the "name" field.
  104. DefaultName string
  105. // DefaultConditionType holds the default value on creation for the "condition_type" field.
  106. DefaultConditionType int
  107. // DefaultNoReplyCondition holds the default value on creation for the "no_reply_condition" field.
  108. DefaultNoReplyCondition uint64
  109. )
  110. // OrderOption defines the ordering options for the SopNode queries.
  111. type OrderOption func(*sql.Selector)
  112. // ByID orders the results by the id field.
  113. func ByID(opts ...sql.OrderTermOption) OrderOption {
  114. return sql.OrderByField(FieldID, opts...).ToFunc()
  115. }
  116. // ByCreatedAt orders the results by the created_at field.
  117. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  118. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  119. }
  120. // ByUpdatedAt orders the results by the updated_at field.
  121. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  122. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  123. }
  124. // ByStatus orders the results by the status field.
  125. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  126. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  127. }
  128. // ByDeletedAt orders the results by the deleted_at field.
  129. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  130. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  131. }
  132. // ByStageID orders the results by the stage_id field.
  133. func ByStageID(opts ...sql.OrderTermOption) OrderOption {
  134. return sql.OrderByField(FieldStageID, opts...).ToFunc()
  135. }
  136. // ByParentID orders the results by the parent_id field.
  137. func ByParentID(opts ...sql.OrderTermOption) OrderOption {
  138. return sql.OrderByField(FieldParentID, opts...).ToFunc()
  139. }
  140. // ByName orders the results by the name field.
  141. func ByName(opts ...sql.OrderTermOption) OrderOption {
  142. return sql.OrderByField(FieldName, opts...).ToFunc()
  143. }
  144. // ByConditionType orders the results by the condition_type field.
  145. func ByConditionType(opts ...sql.OrderTermOption) OrderOption {
  146. return sql.OrderByField(FieldConditionType, opts...).ToFunc()
  147. }
  148. // ByNoReplyCondition orders the results by the no_reply_condition field.
  149. func ByNoReplyCondition(opts ...sql.OrderTermOption) OrderOption {
  150. return sql.OrderByField(FieldNoReplyCondition, opts...).ToFunc()
  151. }
  152. // BySopStageField orders the results by sop_stage field.
  153. func BySopStageField(field string, opts ...sql.OrderTermOption) OrderOption {
  154. return func(s *sql.Selector) {
  155. sqlgraph.OrderByNeighborTerms(s, newSopStageStep(), sql.OrderByField(field, opts...))
  156. }
  157. }
  158. // ByNodeMessagesCount orders the results by node_messages count.
  159. func ByNodeMessagesCount(opts ...sql.OrderTermOption) OrderOption {
  160. return func(s *sql.Selector) {
  161. sqlgraph.OrderByNeighborsCount(s, newNodeMessagesStep(), opts...)
  162. }
  163. }
  164. // ByNodeMessages orders the results by node_messages terms.
  165. func ByNodeMessages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  166. return func(s *sql.Selector) {
  167. sqlgraph.OrderByNeighborTerms(s, newNodeMessagesStep(), append([]sql.OrderTerm{term}, terms...)...)
  168. }
  169. }
  170. func newSopStageStep() *sqlgraph.Step {
  171. return sqlgraph.NewStep(
  172. sqlgraph.From(Table, FieldID),
  173. sqlgraph.To(SopStageInverseTable, FieldID),
  174. sqlgraph.Edge(sqlgraph.M2O, true, SopStageTable, SopStageColumn),
  175. )
  176. }
  177. func newNodeMessagesStep() *sqlgraph.Step {
  178. return sqlgraph.NewStep(
  179. sqlgraph.From(Table, FieldID),
  180. sqlgraph.To(NodeMessagesInverseTable, FieldID),
  181. sqlgraph.Edge(sqlgraph.O2M, false, NodeMessagesTable, NodeMessagesColumn),
  182. )
  183. }