announcement.go 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. // Code generated by ent, DO NOT EDIT.
  2. package announcement
  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 announcement type in the database.
  10. Label = "announcement"
  11. // FieldID holds the string denoting the id field in the database.
  12. FieldID = "id"
  13. // FieldTitle holds the string denoting the title field in the database.
  14. FieldTitle = "title"
  15. // FieldContent holds the string denoting the content field in the database.
  16. FieldContent = "content"
  17. // FieldStatus holds the string denoting the status field in the database.
  18. FieldStatus = "status"
  19. // FieldNotifyMode holds the string denoting the notify_mode field in the database.
  20. FieldNotifyMode = "notify_mode"
  21. // FieldTargeting holds the string denoting the targeting field in the database.
  22. FieldTargeting = "targeting"
  23. // FieldStartsAt holds the string denoting the starts_at field in the database.
  24. FieldStartsAt = "starts_at"
  25. // FieldEndsAt holds the string denoting the ends_at field in the database.
  26. FieldEndsAt = "ends_at"
  27. // FieldCreatedBy holds the string denoting the created_by field in the database.
  28. FieldCreatedBy = "created_by"
  29. // FieldUpdatedBy holds the string denoting the updated_by field in the database.
  30. FieldUpdatedBy = "updated_by"
  31. // FieldCreatedAt holds the string denoting the created_at field in the database.
  32. FieldCreatedAt = "created_at"
  33. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  34. FieldUpdatedAt = "updated_at"
  35. // EdgeReads holds the string denoting the reads edge name in mutations.
  36. EdgeReads = "reads"
  37. // Table holds the table name of the announcement in the database.
  38. Table = "announcements"
  39. // ReadsTable is the table that holds the reads relation/edge.
  40. ReadsTable = "announcement_reads"
  41. // ReadsInverseTable is the table name for the AnnouncementRead entity.
  42. // It exists in this package in order to avoid circular dependency with the "announcementread" package.
  43. ReadsInverseTable = "announcement_reads"
  44. // ReadsColumn is the table column denoting the reads relation/edge.
  45. ReadsColumn = "announcement_id"
  46. )
  47. // Columns holds all SQL columns for announcement fields.
  48. var Columns = []string{
  49. FieldID,
  50. FieldTitle,
  51. FieldContent,
  52. FieldStatus,
  53. FieldNotifyMode,
  54. FieldTargeting,
  55. FieldStartsAt,
  56. FieldEndsAt,
  57. FieldCreatedBy,
  58. FieldUpdatedBy,
  59. FieldCreatedAt,
  60. FieldUpdatedAt,
  61. }
  62. // ValidColumn reports if the column name is valid (part of the table columns).
  63. func ValidColumn(column string) bool {
  64. for i := range Columns {
  65. if column == Columns[i] {
  66. return true
  67. }
  68. }
  69. return false
  70. }
  71. var (
  72. // TitleValidator is a validator for the "title" field. It is called by the builders before save.
  73. TitleValidator func(string) error
  74. // ContentValidator is a validator for the "content" field. It is called by the builders before save.
  75. ContentValidator func(string) error
  76. // DefaultStatus holds the default value on creation for the "status" field.
  77. DefaultStatus string
  78. // StatusValidator is a validator for the "status" field. It is called by the builders before save.
  79. StatusValidator func(string) error
  80. // DefaultNotifyMode holds the default value on creation for the "notify_mode" field.
  81. DefaultNotifyMode string
  82. // NotifyModeValidator is a validator for the "notify_mode" field. It is called by the builders before save.
  83. NotifyModeValidator func(string) error
  84. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  85. DefaultCreatedAt func() time.Time
  86. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  87. DefaultUpdatedAt func() time.Time
  88. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  89. UpdateDefaultUpdatedAt func() time.Time
  90. )
  91. // OrderOption defines the ordering options for the Announcement queries.
  92. type OrderOption func(*sql.Selector)
  93. // ByID orders the results by the id field.
  94. func ByID(opts ...sql.OrderTermOption) OrderOption {
  95. return sql.OrderByField(FieldID, opts...).ToFunc()
  96. }
  97. // ByTitle orders the results by the title field.
  98. func ByTitle(opts ...sql.OrderTermOption) OrderOption {
  99. return sql.OrderByField(FieldTitle, opts...).ToFunc()
  100. }
  101. // ByContent orders the results by the content field.
  102. func ByContent(opts ...sql.OrderTermOption) OrderOption {
  103. return sql.OrderByField(FieldContent, opts...).ToFunc()
  104. }
  105. // ByStatus orders the results by the status field.
  106. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  107. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  108. }
  109. // ByNotifyMode orders the results by the notify_mode field.
  110. func ByNotifyMode(opts ...sql.OrderTermOption) OrderOption {
  111. return sql.OrderByField(FieldNotifyMode, opts...).ToFunc()
  112. }
  113. // ByStartsAt orders the results by the starts_at field.
  114. func ByStartsAt(opts ...sql.OrderTermOption) OrderOption {
  115. return sql.OrderByField(FieldStartsAt, opts...).ToFunc()
  116. }
  117. // ByEndsAt orders the results by the ends_at field.
  118. func ByEndsAt(opts ...sql.OrderTermOption) OrderOption {
  119. return sql.OrderByField(FieldEndsAt, opts...).ToFunc()
  120. }
  121. // ByCreatedBy orders the results by the created_by field.
  122. func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
  123. return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
  124. }
  125. // ByUpdatedBy orders the results by the updated_by field.
  126. func ByUpdatedBy(opts ...sql.OrderTermOption) OrderOption {
  127. return sql.OrderByField(FieldUpdatedBy, opts...).ToFunc()
  128. }
  129. // ByCreatedAt orders the results by the created_at field.
  130. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  131. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  132. }
  133. // ByUpdatedAt orders the results by the updated_at field.
  134. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  135. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  136. }
  137. // ByReadsCount orders the results by reads count.
  138. func ByReadsCount(opts ...sql.OrderTermOption) OrderOption {
  139. return func(s *sql.Selector) {
  140. sqlgraph.OrderByNeighborsCount(s, newReadsStep(), opts...)
  141. }
  142. }
  143. // ByReads orders the results by reads terms.
  144. func ByReads(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  145. return func(s *sql.Selector) {
  146. sqlgraph.OrderByNeighborTerms(s, newReadsStep(), append([]sql.OrderTerm{term}, terms...)...)
  147. }
  148. }
  149. func newReadsStep() *sqlgraph.Step {
  150. return sqlgraph.NewStep(
  151. sqlgraph.From(Table, FieldID),
  152. sqlgraph.To(ReadsInverseTable, FieldID),
  153. sqlgraph.Edge(sqlgraph.O2M, false, ReadsTable, ReadsColumn),
  154. )
  155. }