tutorial.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. // Code generated by ent, DO NOT EDIT.
  2. package tutorial
  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 tutorial type in the database.
  11. Label = "tutorial"
  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. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  19. FieldDeletedAt = "deleted_at"
  20. // FieldEmployeeID holds the string denoting the employee_id field in the database.
  21. FieldEmployeeID = "employee_id"
  22. // FieldIndex holds the string denoting the index field in the database.
  23. FieldIndex = "index"
  24. // FieldTitle holds the string denoting the title field in the database.
  25. FieldTitle = "title"
  26. // FieldContent holds the string denoting the content field in the database.
  27. FieldContent = "content"
  28. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  29. FieldOrganizationID = "organization_id"
  30. // EdgeEmployee holds the string denoting the employee edge name in mutations.
  31. EdgeEmployee = "employee"
  32. // Table holds the table name of the tutorial in the database.
  33. Table = "tutorial"
  34. // EmployeeTable is the table that holds the employee relation/edge.
  35. EmployeeTable = "tutorial"
  36. // EmployeeInverseTable is the table name for the Employee entity.
  37. // It exists in this package in order to avoid circular dependency with the "employee" package.
  38. EmployeeInverseTable = "employee"
  39. // EmployeeColumn is the table column denoting the employee relation/edge.
  40. EmployeeColumn = "employee_id"
  41. )
  42. // Columns holds all SQL columns for tutorial fields.
  43. var Columns = []string{
  44. FieldID,
  45. FieldCreatedAt,
  46. FieldUpdatedAt,
  47. FieldDeletedAt,
  48. FieldEmployeeID,
  49. FieldIndex,
  50. FieldTitle,
  51. FieldContent,
  52. FieldOrganizationID,
  53. }
  54. // ValidColumn reports if the column name is valid (part of the table columns).
  55. func ValidColumn(column string) bool {
  56. for i := range Columns {
  57. if column == Columns[i] {
  58. return true
  59. }
  60. }
  61. return false
  62. }
  63. // Note that the variables below are initialized by the runtime
  64. // package on the initialization of the application. Therefore,
  65. // it should be imported in the main as follows:
  66. //
  67. // import _ "wechat-api/ent/runtime"
  68. var (
  69. Hooks [1]ent.Hook
  70. Interceptors [1]ent.Interceptor
  71. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  72. DefaultCreatedAt func() time.Time
  73. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  74. DefaultUpdatedAt func() time.Time
  75. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  76. UpdateDefaultUpdatedAt func() time.Time
  77. // EmployeeIDValidator is a validator for the "employee_id" field. It is called by the builders before save.
  78. EmployeeIDValidator func(uint64) error
  79. // OrganizationIDValidator is a validator for the "organization_id" field. It is called by the builders before save.
  80. OrganizationIDValidator func(uint64) error
  81. )
  82. // OrderOption defines the ordering options for the Tutorial queries.
  83. type OrderOption func(*sql.Selector)
  84. // ByID orders the results by the id field.
  85. func ByID(opts ...sql.OrderTermOption) OrderOption {
  86. return sql.OrderByField(FieldID, opts...).ToFunc()
  87. }
  88. // ByCreatedAt orders the results by the created_at field.
  89. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  90. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  91. }
  92. // ByUpdatedAt orders the results by the updated_at field.
  93. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  94. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  95. }
  96. // ByDeletedAt orders the results by the deleted_at field.
  97. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  98. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  99. }
  100. // ByEmployeeID orders the results by the employee_id field.
  101. func ByEmployeeID(opts ...sql.OrderTermOption) OrderOption {
  102. return sql.OrderByField(FieldEmployeeID, opts...).ToFunc()
  103. }
  104. // ByIndex orders the results by the index field.
  105. func ByIndex(opts ...sql.OrderTermOption) OrderOption {
  106. return sql.OrderByField(FieldIndex, opts...).ToFunc()
  107. }
  108. // ByTitle orders the results by the title field.
  109. func ByTitle(opts ...sql.OrderTermOption) OrderOption {
  110. return sql.OrderByField(FieldTitle, opts...).ToFunc()
  111. }
  112. // ByContent orders the results by the content field.
  113. func ByContent(opts ...sql.OrderTermOption) OrderOption {
  114. return sql.OrderByField(FieldContent, opts...).ToFunc()
  115. }
  116. // ByOrganizationID orders the results by the organization_id field.
  117. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  118. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  119. }
  120. // ByEmployeeField orders the results by employee field.
  121. func ByEmployeeField(field string, opts ...sql.OrderTermOption) OrderOption {
  122. return func(s *sql.Selector) {
  123. sqlgraph.OrderByNeighborTerms(s, newEmployeeStep(), sql.OrderByField(field, opts...))
  124. }
  125. }
  126. func newEmployeeStep() *sqlgraph.Step {
  127. return sqlgraph.NewStep(
  128. sqlgraph.From(Table, FieldID),
  129. sqlgraph.To(EmployeeInverseTable, FieldID),
  130. sqlgraph.Edge(sqlgraph.M2O, true, EmployeeTable, EmployeeColumn),
  131. )
  132. }