sopstage.go 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. // Code generated by ent, DO NOT EDIT.
  2. package sopstage
  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 sopstage type in the database.
  11. Label = "sop_stage"
  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. // FieldTaskID holds the string denoting the task_id field in the database.
  23. FieldTaskID = "task_id"
  24. // FieldName holds the string denoting the name field in the database.
  25. FieldName = "name"
  26. // FieldConditionType holds the string denoting the condition_type field in the database.
  27. FieldConditionType = "condition_type"
  28. // FieldConditionOperator holds the string denoting the condition_operator field in the database.
  29. FieldConditionOperator = "condition_operator"
  30. // FieldConditionList holds the string denoting the condition_list field in the database.
  31. FieldConditionList = "condition_list"
  32. // FieldActionMessage holds the string denoting the action_message field in the database.
  33. FieldActionMessage = "action_message"
  34. // FieldActionLabelAdd holds the string denoting the action_label_add field in the database.
  35. FieldActionLabelAdd = "action_label_add"
  36. // FieldActionLabelDel holds the string denoting the action_label_del field in the database.
  37. FieldActionLabelDel = "action_label_del"
  38. // FieldActionForward holds the string denoting the action_forward field in the database.
  39. FieldActionForward = "action_forward"
  40. // FieldIndexSort holds the string denoting the index_sort field in the database.
  41. FieldIndexSort = "index_sort"
  42. // EdgeSopTask holds the string denoting the sop_task edge name in mutations.
  43. EdgeSopTask = "sop_task"
  44. // EdgeStageNodes holds the string denoting the stage_nodes edge name in mutations.
  45. EdgeStageNodes = "stage_nodes"
  46. // EdgeStageMessages holds the string denoting the stage_messages edge name in mutations.
  47. EdgeStageMessages = "stage_messages"
  48. // Table holds the table name of the sopstage in the database.
  49. Table = "sop_stage"
  50. // SopTaskTable is the table that holds the sop_task relation/edge.
  51. SopTaskTable = "sop_stage"
  52. // SopTaskInverseTable is the table name for the SopTask entity.
  53. // It exists in this package in order to avoid circular dependency with the "soptask" package.
  54. SopTaskInverseTable = "sop_task"
  55. // SopTaskColumn is the table column denoting the sop_task relation/edge.
  56. SopTaskColumn = "task_id"
  57. // StageNodesTable is the table that holds the stage_nodes relation/edge.
  58. StageNodesTable = "sop_node"
  59. // StageNodesInverseTable is the table name for the SopNode entity.
  60. // It exists in this package in order to avoid circular dependency with the "sopnode" package.
  61. StageNodesInverseTable = "sop_node"
  62. // StageNodesColumn is the table column denoting the stage_nodes relation/edge.
  63. StageNodesColumn = "stage_id"
  64. // StageMessagesTable is the table that holds the stage_messages relation/edge.
  65. StageMessagesTable = "message_records"
  66. // StageMessagesInverseTable is the table name for the MessageRecords entity.
  67. // It exists in this package in order to avoid circular dependency with the "messagerecords" package.
  68. StageMessagesInverseTable = "message_records"
  69. // StageMessagesColumn is the table column denoting the stage_messages relation/edge.
  70. StageMessagesColumn = "source_id"
  71. )
  72. // Columns holds all SQL columns for sopstage fields.
  73. var Columns = []string{
  74. FieldID,
  75. FieldCreatedAt,
  76. FieldUpdatedAt,
  77. FieldStatus,
  78. FieldDeletedAt,
  79. FieldTaskID,
  80. FieldName,
  81. FieldConditionType,
  82. FieldConditionOperator,
  83. FieldConditionList,
  84. FieldActionMessage,
  85. FieldActionLabelAdd,
  86. FieldActionLabelDel,
  87. FieldActionForward,
  88. FieldIndexSort,
  89. }
  90. // ValidColumn reports if the column name is valid (part of the table columns).
  91. func ValidColumn(column string) bool {
  92. for i := range Columns {
  93. if column == Columns[i] {
  94. return true
  95. }
  96. }
  97. return false
  98. }
  99. // Note that the variables below are initialized by the runtime
  100. // package on the initialization of the application. Therefore,
  101. // it should be imported in the main as follows:
  102. //
  103. // import _ "wechat-api/ent/runtime"
  104. var (
  105. Hooks [1]ent.Hook
  106. Interceptors [1]ent.Interceptor
  107. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  108. DefaultCreatedAt func() time.Time
  109. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  110. DefaultUpdatedAt func() time.Time
  111. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  112. UpdateDefaultUpdatedAt func() time.Time
  113. // DefaultStatus holds the default value on creation for the "status" field.
  114. DefaultStatus uint8
  115. // DefaultName holds the default value on creation for the "name" field.
  116. DefaultName string
  117. // DefaultConditionType holds the default value on creation for the "condition_type" field.
  118. DefaultConditionType int
  119. // DefaultConditionOperator holds the default value on creation for the "condition_operator" field.
  120. DefaultConditionOperator int
  121. // DefaultIndexSort holds the default value on creation for the "index_sort" field.
  122. DefaultIndexSort int
  123. )
  124. // OrderOption defines the ordering options for the SopStage queries.
  125. type OrderOption func(*sql.Selector)
  126. // ByID orders the results by the id field.
  127. func ByID(opts ...sql.OrderTermOption) OrderOption {
  128. return sql.OrderByField(FieldID, opts...).ToFunc()
  129. }
  130. // ByCreatedAt orders the results by the created_at field.
  131. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  132. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  133. }
  134. // ByUpdatedAt orders the results by the updated_at field.
  135. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  136. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  137. }
  138. // ByStatus orders the results by the status field.
  139. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  140. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  141. }
  142. // ByDeletedAt orders the results by the deleted_at field.
  143. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  144. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  145. }
  146. // ByTaskID orders the results by the task_id field.
  147. func ByTaskID(opts ...sql.OrderTermOption) OrderOption {
  148. return sql.OrderByField(FieldTaskID, opts...).ToFunc()
  149. }
  150. // ByName orders the results by the name field.
  151. func ByName(opts ...sql.OrderTermOption) OrderOption {
  152. return sql.OrderByField(FieldName, opts...).ToFunc()
  153. }
  154. // ByConditionType orders the results by the condition_type field.
  155. func ByConditionType(opts ...sql.OrderTermOption) OrderOption {
  156. return sql.OrderByField(FieldConditionType, opts...).ToFunc()
  157. }
  158. // ByConditionOperator orders the results by the condition_operator field.
  159. func ByConditionOperator(opts ...sql.OrderTermOption) OrderOption {
  160. return sql.OrderByField(FieldConditionOperator, opts...).ToFunc()
  161. }
  162. // ByIndexSort orders the results by the index_sort field.
  163. func ByIndexSort(opts ...sql.OrderTermOption) OrderOption {
  164. return sql.OrderByField(FieldIndexSort, opts...).ToFunc()
  165. }
  166. // BySopTaskField orders the results by sop_task field.
  167. func BySopTaskField(field string, opts ...sql.OrderTermOption) OrderOption {
  168. return func(s *sql.Selector) {
  169. sqlgraph.OrderByNeighborTerms(s, newSopTaskStep(), sql.OrderByField(field, opts...))
  170. }
  171. }
  172. // ByStageNodesCount orders the results by stage_nodes count.
  173. func ByStageNodesCount(opts ...sql.OrderTermOption) OrderOption {
  174. return func(s *sql.Selector) {
  175. sqlgraph.OrderByNeighborsCount(s, newStageNodesStep(), opts...)
  176. }
  177. }
  178. // ByStageNodes orders the results by stage_nodes terms.
  179. func ByStageNodes(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  180. return func(s *sql.Selector) {
  181. sqlgraph.OrderByNeighborTerms(s, newStageNodesStep(), append([]sql.OrderTerm{term}, terms...)...)
  182. }
  183. }
  184. // ByStageMessagesCount orders the results by stage_messages count.
  185. func ByStageMessagesCount(opts ...sql.OrderTermOption) OrderOption {
  186. return func(s *sql.Selector) {
  187. sqlgraph.OrderByNeighborsCount(s, newStageMessagesStep(), opts...)
  188. }
  189. }
  190. // ByStageMessages orders the results by stage_messages terms.
  191. func ByStageMessages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  192. return func(s *sql.Selector) {
  193. sqlgraph.OrderByNeighborTerms(s, newStageMessagesStep(), append([]sql.OrderTerm{term}, terms...)...)
  194. }
  195. }
  196. func newSopTaskStep() *sqlgraph.Step {
  197. return sqlgraph.NewStep(
  198. sqlgraph.From(Table, FieldID),
  199. sqlgraph.To(SopTaskInverseTable, FieldID),
  200. sqlgraph.Edge(sqlgraph.M2O, true, SopTaskTable, SopTaskColumn),
  201. )
  202. }
  203. func newStageNodesStep() *sqlgraph.Step {
  204. return sqlgraph.NewStep(
  205. sqlgraph.From(Table, FieldID),
  206. sqlgraph.To(StageNodesInverseTable, FieldID),
  207. sqlgraph.Edge(sqlgraph.O2M, false, StageNodesTable, StageNodesColumn),
  208. )
  209. }
  210. func newStageMessagesStep() *sqlgraph.Step {
  211. return sqlgraph.NewStep(
  212. sqlgraph.From(Table, FieldID),
  213. sqlgraph.To(StageMessagesInverseTable, FieldID),
  214. sqlgraph.Edge(sqlgraph.O2M, false, StageMessagesTable, StageMessagesColumn),
  215. )
  216. }