tasklog.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // Code generated by ent, DO NOT EDIT.
  2. package tasklog
  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 tasklog type in the database.
  10. Label = "task_log"
  11. // FieldID holds the string denoting the id field in the database.
  12. FieldID = "id"
  13. // FieldStartedAt holds the string denoting the started_at field in the database.
  14. FieldStartedAt = "started_at"
  15. // FieldFinishedAt holds the string denoting the finished_at field in the database.
  16. FieldFinishedAt = "finished_at"
  17. // FieldResult holds the string denoting the result field in the database.
  18. FieldResult = "result"
  19. // EdgeTasks holds the string denoting the tasks edge name in mutations.
  20. EdgeTasks = "tasks"
  21. // Table holds the table name of the tasklog in the database.
  22. Table = "sys_task_logs"
  23. // TasksTable is the table that holds the tasks relation/edge.
  24. TasksTable = "sys_task_logs"
  25. // TasksInverseTable is the table name for the Task entity.
  26. // It exists in this package in order to avoid circular dependency with the "task" package.
  27. TasksInverseTable = "sys_tasks"
  28. // TasksColumn is the table column denoting the tasks relation/edge.
  29. TasksColumn = "task_task_logs"
  30. )
  31. // Columns holds all SQL columns for tasklog fields.
  32. var Columns = []string{
  33. FieldID,
  34. FieldStartedAt,
  35. FieldFinishedAt,
  36. FieldResult,
  37. }
  38. // ForeignKeys holds the SQL foreign-keys that are owned by the "sys_task_logs"
  39. // table and are not defined as standalone fields in the schema.
  40. var ForeignKeys = []string{
  41. "task_task_logs",
  42. }
  43. // ValidColumn reports if the column name is valid (part of the table columns).
  44. func ValidColumn(column string) bool {
  45. for i := range Columns {
  46. if column == Columns[i] {
  47. return true
  48. }
  49. }
  50. for i := range ForeignKeys {
  51. if column == ForeignKeys[i] {
  52. return true
  53. }
  54. }
  55. return false
  56. }
  57. var (
  58. // DefaultStartedAt holds the default value on creation for the "started_at" field.
  59. DefaultStartedAt func() time.Time
  60. )
  61. // OrderOption defines the ordering options for the TaskLog queries.
  62. type OrderOption func(*sql.Selector)
  63. // ByID orders the results by the id field.
  64. func ByID(opts ...sql.OrderTermOption) OrderOption {
  65. return sql.OrderByField(FieldID, opts...).ToFunc()
  66. }
  67. // ByStartedAt orders the results by the started_at field.
  68. func ByStartedAt(opts ...sql.OrderTermOption) OrderOption {
  69. return sql.OrderByField(FieldStartedAt, opts...).ToFunc()
  70. }
  71. // ByFinishedAt orders the results by the finished_at field.
  72. func ByFinishedAt(opts ...sql.OrderTermOption) OrderOption {
  73. return sql.OrderByField(FieldFinishedAt, opts...).ToFunc()
  74. }
  75. // ByResult orders the results by the result field.
  76. func ByResult(opts ...sql.OrderTermOption) OrderOption {
  77. return sql.OrderByField(FieldResult, opts...).ToFunc()
  78. }
  79. // ByTasksField orders the results by tasks field.
  80. func ByTasksField(field string, opts ...sql.OrderTermOption) OrderOption {
  81. return func(s *sql.Selector) {
  82. sqlgraph.OrderByNeighborTerms(s, newTasksStep(), sql.OrderByField(field, opts...))
  83. }
  84. }
  85. func newTasksStep() *sqlgraph.Step {
  86. return sqlgraph.NewStep(
  87. sqlgraph.From(Table, FieldID),
  88. sqlgraph.To(TasksInverseTable, FieldID),
  89. sqlgraph.Edge(sqlgraph.M2O, true, TasksTable, TasksColumn),
  90. )
  91. }