channelmonitordailyrollup.go 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. // Code generated by ent, DO NOT EDIT.
  2. package channelmonitordailyrollup
  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 channelmonitordailyrollup type in the database.
  10. Label = "channel_monitor_daily_rollup"
  11. // FieldID holds the string denoting the id field in the database.
  12. FieldID = "id"
  13. // FieldMonitorID holds the string denoting the monitor_id field in the database.
  14. FieldMonitorID = "monitor_id"
  15. // FieldModel holds the string denoting the model field in the database.
  16. FieldModel = "model"
  17. // FieldBucketDate holds the string denoting the bucket_date field in the database.
  18. FieldBucketDate = "bucket_date"
  19. // FieldTotalChecks holds the string denoting the total_checks field in the database.
  20. FieldTotalChecks = "total_checks"
  21. // FieldOkCount holds the string denoting the ok_count field in the database.
  22. FieldOkCount = "ok_count"
  23. // FieldOperationalCount holds the string denoting the operational_count field in the database.
  24. FieldOperationalCount = "operational_count"
  25. // FieldDegradedCount holds the string denoting the degraded_count field in the database.
  26. FieldDegradedCount = "degraded_count"
  27. // FieldFailedCount holds the string denoting the failed_count field in the database.
  28. FieldFailedCount = "failed_count"
  29. // FieldErrorCount holds the string denoting the error_count field in the database.
  30. FieldErrorCount = "error_count"
  31. // FieldSumLatencyMs holds the string denoting the sum_latency_ms field in the database.
  32. FieldSumLatencyMs = "sum_latency_ms"
  33. // FieldCountLatency holds the string denoting the count_latency field in the database.
  34. FieldCountLatency = "count_latency"
  35. // FieldSumPingLatencyMs holds the string denoting the sum_ping_latency_ms field in the database.
  36. FieldSumPingLatencyMs = "sum_ping_latency_ms"
  37. // FieldCountPingLatency holds the string denoting the count_ping_latency field in the database.
  38. FieldCountPingLatency = "count_ping_latency"
  39. // FieldComputedAt holds the string denoting the computed_at field in the database.
  40. FieldComputedAt = "computed_at"
  41. // EdgeMonitor holds the string denoting the monitor edge name in mutations.
  42. EdgeMonitor = "monitor"
  43. // Table holds the table name of the channelmonitordailyrollup in the database.
  44. Table = "channel_monitor_daily_rollups"
  45. // MonitorTable is the table that holds the monitor relation/edge.
  46. MonitorTable = "channel_monitor_daily_rollups"
  47. // MonitorInverseTable is the table name for the ChannelMonitor entity.
  48. // It exists in this package in order to avoid circular dependency with the "channelmonitor" package.
  49. MonitorInverseTable = "channel_monitors"
  50. // MonitorColumn is the table column denoting the monitor relation/edge.
  51. MonitorColumn = "monitor_id"
  52. )
  53. // Columns holds all SQL columns for channelmonitordailyrollup fields.
  54. var Columns = []string{
  55. FieldID,
  56. FieldMonitorID,
  57. FieldModel,
  58. FieldBucketDate,
  59. FieldTotalChecks,
  60. FieldOkCount,
  61. FieldOperationalCount,
  62. FieldDegradedCount,
  63. FieldFailedCount,
  64. FieldErrorCount,
  65. FieldSumLatencyMs,
  66. FieldCountLatency,
  67. FieldSumPingLatencyMs,
  68. FieldCountPingLatency,
  69. FieldComputedAt,
  70. }
  71. // ValidColumn reports if the column name is valid (part of the table columns).
  72. func ValidColumn(column string) bool {
  73. for i := range Columns {
  74. if column == Columns[i] {
  75. return true
  76. }
  77. }
  78. return false
  79. }
  80. var (
  81. // ModelValidator is a validator for the "model" field. It is called by the builders before save.
  82. ModelValidator func(string) error
  83. // DefaultTotalChecks holds the default value on creation for the "total_checks" field.
  84. DefaultTotalChecks int
  85. // DefaultOkCount holds the default value on creation for the "ok_count" field.
  86. DefaultOkCount int
  87. // DefaultOperationalCount holds the default value on creation for the "operational_count" field.
  88. DefaultOperationalCount int
  89. // DefaultDegradedCount holds the default value on creation for the "degraded_count" field.
  90. DefaultDegradedCount int
  91. // DefaultFailedCount holds the default value on creation for the "failed_count" field.
  92. DefaultFailedCount int
  93. // DefaultErrorCount holds the default value on creation for the "error_count" field.
  94. DefaultErrorCount int
  95. // DefaultSumLatencyMs holds the default value on creation for the "sum_latency_ms" field.
  96. DefaultSumLatencyMs int64
  97. // DefaultCountLatency holds the default value on creation for the "count_latency" field.
  98. DefaultCountLatency int
  99. // DefaultSumPingLatencyMs holds the default value on creation for the "sum_ping_latency_ms" field.
  100. DefaultSumPingLatencyMs int64
  101. // DefaultCountPingLatency holds the default value on creation for the "count_ping_latency" field.
  102. DefaultCountPingLatency int
  103. // DefaultComputedAt holds the default value on creation for the "computed_at" field.
  104. DefaultComputedAt func() time.Time
  105. // UpdateDefaultComputedAt holds the default value on update for the "computed_at" field.
  106. UpdateDefaultComputedAt func() time.Time
  107. )
  108. // OrderOption defines the ordering options for the ChannelMonitorDailyRollup queries.
  109. type OrderOption func(*sql.Selector)
  110. // ByID orders the results by the id field.
  111. func ByID(opts ...sql.OrderTermOption) OrderOption {
  112. return sql.OrderByField(FieldID, opts...).ToFunc()
  113. }
  114. // ByMonitorID orders the results by the monitor_id field.
  115. func ByMonitorID(opts ...sql.OrderTermOption) OrderOption {
  116. return sql.OrderByField(FieldMonitorID, opts...).ToFunc()
  117. }
  118. // ByModel orders the results by the model field.
  119. func ByModel(opts ...sql.OrderTermOption) OrderOption {
  120. return sql.OrderByField(FieldModel, opts...).ToFunc()
  121. }
  122. // ByBucketDate orders the results by the bucket_date field.
  123. func ByBucketDate(opts ...sql.OrderTermOption) OrderOption {
  124. return sql.OrderByField(FieldBucketDate, opts...).ToFunc()
  125. }
  126. // ByTotalChecks orders the results by the total_checks field.
  127. func ByTotalChecks(opts ...sql.OrderTermOption) OrderOption {
  128. return sql.OrderByField(FieldTotalChecks, opts...).ToFunc()
  129. }
  130. // ByOkCount orders the results by the ok_count field.
  131. func ByOkCount(opts ...sql.OrderTermOption) OrderOption {
  132. return sql.OrderByField(FieldOkCount, opts...).ToFunc()
  133. }
  134. // ByOperationalCount orders the results by the operational_count field.
  135. func ByOperationalCount(opts ...sql.OrderTermOption) OrderOption {
  136. return sql.OrderByField(FieldOperationalCount, opts...).ToFunc()
  137. }
  138. // ByDegradedCount orders the results by the degraded_count field.
  139. func ByDegradedCount(opts ...sql.OrderTermOption) OrderOption {
  140. return sql.OrderByField(FieldDegradedCount, opts...).ToFunc()
  141. }
  142. // ByFailedCount orders the results by the failed_count field.
  143. func ByFailedCount(opts ...sql.OrderTermOption) OrderOption {
  144. return sql.OrderByField(FieldFailedCount, opts...).ToFunc()
  145. }
  146. // ByErrorCount orders the results by the error_count field.
  147. func ByErrorCount(opts ...sql.OrderTermOption) OrderOption {
  148. return sql.OrderByField(FieldErrorCount, opts...).ToFunc()
  149. }
  150. // BySumLatencyMs orders the results by the sum_latency_ms field.
  151. func BySumLatencyMs(opts ...sql.OrderTermOption) OrderOption {
  152. return sql.OrderByField(FieldSumLatencyMs, opts...).ToFunc()
  153. }
  154. // ByCountLatency orders the results by the count_latency field.
  155. func ByCountLatency(opts ...sql.OrderTermOption) OrderOption {
  156. return sql.OrderByField(FieldCountLatency, opts...).ToFunc()
  157. }
  158. // BySumPingLatencyMs orders the results by the sum_ping_latency_ms field.
  159. func BySumPingLatencyMs(opts ...sql.OrderTermOption) OrderOption {
  160. return sql.OrderByField(FieldSumPingLatencyMs, opts...).ToFunc()
  161. }
  162. // ByCountPingLatency orders the results by the count_ping_latency field.
  163. func ByCountPingLatency(opts ...sql.OrderTermOption) OrderOption {
  164. return sql.OrderByField(FieldCountPingLatency, opts...).ToFunc()
  165. }
  166. // ByComputedAt orders the results by the computed_at field.
  167. func ByComputedAt(opts ...sql.OrderTermOption) OrderOption {
  168. return sql.OrderByField(FieldComputedAt, opts...).ToFunc()
  169. }
  170. // ByMonitorField orders the results by monitor field.
  171. func ByMonitorField(field string, opts ...sql.OrderTermOption) OrderOption {
  172. return func(s *sql.Selector) {
  173. sqlgraph.OrderByNeighborTerms(s, newMonitorStep(), sql.OrderByField(field, opts...))
  174. }
  175. }
  176. func newMonitorStep() *sqlgraph.Step {
  177. return sqlgraph.NewStep(
  178. sqlgraph.From(Table, FieldID),
  179. sqlgraph.To(MonitorInverseTable, FieldID),
  180. sqlgraph.Edge(sqlgraph.M2O, true, MonitorTable, MonitorColumn),
  181. )
  182. }