task.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // Code generated by ent, DO NOT EDIT.
  2. package task
  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 task type in the database.
  10. Label = "task"
  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. // FieldStatus holds the string denoting the status field in the database.
  18. FieldStatus = "status"
  19. // FieldName holds the string denoting the name field in the database.
  20. FieldName = "name"
  21. // FieldTaskGroup holds the string denoting the task_group field in the database.
  22. FieldTaskGroup = "task_group"
  23. // FieldCronExpression holds the string denoting the cron_expression field in the database.
  24. FieldCronExpression = "cron_expression"
  25. // FieldPattern holds the string denoting the pattern field in the database.
  26. FieldPattern = "pattern"
  27. // FieldPayload holds the string denoting the payload field in the database.
  28. FieldPayload = "payload"
  29. // EdgeTaskLogs holds the string denoting the task_logs edge name in mutations.
  30. EdgeTaskLogs = "task_logs"
  31. // Table holds the table name of the task in the database.
  32. Table = "sys_tasks"
  33. // TaskLogsTable is the table that holds the task_logs relation/edge.
  34. TaskLogsTable = "sys_task_logs"
  35. // TaskLogsInverseTable is the table name for the TaskLog entity.
  36. // It exists in this package in order to avoid circular dependency with the "tasklog" package.
  37. TaskLogsInverseTable = "sys_task_logs"
  38. // TaskLogsColumn is the table column denoting the task_logs relation/edge.
  39. TaskLogsColumn = "task_task_logs"
  40. )
  41. // Columns holds all SQL columns for task fields.
  42. var Columns = []string{
  43. FieldID,
  44. FieldCreatedAt,
  45. FieldUpdatedAt,
  46. FieldStatus,
  47. FieldName,
  48. FieldTaskGroup,
  49. FieldCronExpression,
  50. FieldPattern,
  51. FieldPayload,
  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. // DefaultStatus holds the default value on creation for the "status" field.
  70. DefaultStatus uint8
  71. )
  72. // OrderOption defines the ordering options for the Task 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. // ByStatus orders the results by the status field.
  87. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  88. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  89. }
  90. // ByName orders the results by the name field.
  91. func ByName(opts ...sql.OrderTermOption) OrderOption {
  92. return sql.OrderByField(FieldName, opts...).ToFunc()
  93. }
  94. // ByTaskGroup orders the results by the task_group field.
  95. func ByTaskGroup(opts ...sql.OrderTermOption) OrderOption {
  96. return sql.OrderByField(FieldTaskGroup, opts...).ToFunc()
  97. }
  98. // ByCronExpression orders the results by the cron_expression field.
  99. func ByCronExpression(opts ...sql.OrderTermOption) OrderOption {
  100. return sql.OrderByField(FieldCronExpression, opts...).ToFunc()
  101. }
  102. // ByPattern orders the results by the pattern field.
  103. func ByPattern(opts ...sql.OrderTermOption) OrderOption {
  104. return sql.OrderByField(FieldPattern, opts...).ToFunc()
  105. }
  106. // ByPayload orders the results by the payload field.
  107. func ByPayload(opts ...sql.OrderTermOption) OrderOption {
  108. return sql.OrderByField(FieldPayload, opts...).ToFunc()
  109. }
  110. // ByTaskLogsCount orders the results by task_logs count.
  111. func ByTaskLogsCount(opts ...sql.OrderTermOption) OrderOption {
  112. return func(s *sql.Selector) {
  113. sqlgraph.OrderByNeighborsCount(s, newTaskLogsStep(), opts...)
  114. }
  115. }
  116. // ByTaskLogs orders the results by task_logs terms.
  117. func ByTaskLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  118. return func(s *sql.Selector) {
  119. sqlgraph.OrderByNeighborTerms(s, newTaskLogsStep(), append([]sql.OrderTerm{term}, terms...)...)
  120. }
  121. }
  122. func newTaskLogsStep() *sqlgraph.Step {
  123. return sqlgraph.NewStep(
  124. sqlgraph.From(Table, FieldID),
  125. sqlgraph.To(TaskLogsInverseTable, FieldID),
  126. sqlgraph.Edge(sqlgraph.O2M, false, TaskLogsTable, TaskLogsColumn),
  127. )
  128. }