userplatformquota.go 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. // Code generated by ent, DO NOT EDIT.
  2. package userplatformquota
  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 userplatformquota type in the database.
  11. Label = "user_platform_quota"
  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. // FieldUserID holds the string denoting the user_id field in the database.
  21. FieldUserID = "user_id"
  22. // FieldPlatform holds the string denoting the platform field in the database.
  23. FieldPlatform = "platform"
  24. // FieldDailyLimitUsd holds the string denoting the daily_limit_usd field in the database.
  25. FieldDailyLimitUsd = "daily_limit_usd"
  26. // FieldWeeklyLimitUsd holds the string denoting the weekly_limit_usd field in the database.
  27. FieldWeeklyLimitUsd = "weekly_limit_usd"
  28. // FieldMonthlyLimitUsd holds the string denoting the monthly_limit_usd field in the database.
  29. FieldMonthlyLimitUsd = "monthly_limit_usd"
  30. // FieldDailyUsageUsd holds the string denoting the daily_usage_usd field in the database.
  31. FieldDailyUsageUsd = "daily_usage_usd"
  32. // FieldWeeklyUsageUsd holds the string denoting the weekly_usage_usd field in the database.
  33. FieldWeeklyUsageUsd = "weekly_usage_usd"
  34. // FieldMonthlyUsageUsd holds the string denoting the monthly_usage_usd field in the database.
  35. FieldMonthlyUsageUsd = "monthly_usage_usd"
  36. // FieldDailyWindowStart holds the string denoting the daily_window_start field in the database.
  37. FieldDailyWindowStart = "daily_window_start"
  38. // FieldWeeklyWindowStart holds the string denoting the weekly_window_start field in the database.
  39. FieldWeeklyWindowStart = "weekly_window_start"
  40. // FieldMonthlyWindowStart holds the string denoting the monthly_window_start field in the database.
  41. FieldMonthlyWindowStart = "monthly_window_start"
  42. // EdgeUser holds the string denoting the user edge name in mutations.
  43. EdgeUser = "user"
  44. // Table holds the table name of the userplatformquota in the database.
  45. Table = "user_platform_quotas"
  46. // UserTable is the table that holds the user relation/edge.
  47. UserTable = "user_platform_quotas"
  48. // UserInverseTable is the table name for the User entity.
  49. // It exists in this package in order to avoid circular dependency with the "user" package.
  50. UserInverseTable = "users"
  51. // UserColumn is the table column denoting the user relation/edge.
  52. UserColumn = "user_id"
  53. )
  54. // Columns holds all SQL columns for userplatformquota fields.
  55. var Columns = []string{
  56. FieldID,
  57. FieldCreatedAt,
  58. FieldUpdatedAt,
  59. FieldDeletedAt,
  60. FieldUserID,
  61. FieldPlatform,
  62. FieldDailyLimitUsd,
  63. FieldWeeklyLimitUsd,
  64. FieldMonthlyLimitUsd,
  65. FieldDailyUsageUsd,
  66. FieldWeeklyUsageUsd,
  67. FieldMonthlyUsageUsd,
  68. FieldDailyWindowStart,
  69. FieldWeeklyWindowStart,
  70. FieldMonthlyWindowStart,
  71. }
  72. // ValidColumn reports if the column name is valid (part of the table columns).
  73. func ValidColumn(column string) bool {
  74. for i := range Columns {
  75. if column == Columns[i] {
  76. return true
  77. }
  78. }
  79. return false
  80. }
  81. // Note that the variables below are initialized by the runtime
  82. // package on the initialization of the application. Therefore,
  83. // it should be imported in the main as follows:
  84. //
  85. // import _ "github.com/Wei-Shaw/sub2api/ent/runtime"
  86. var (
  87. Hooks [1]ent.Hook
  88. Interceptors [1]ent.Interceptor
  89. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  90. DefaultCreatedAt func() time.Time
  91. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  92. DefaultUpdatedAt func() time.Time
  93. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  94. UpdateDefaultUpdatedAt func() time.Time
  95. // PlatformValidator is a validator for the "platform" field. It is called by the builders before save.
  96. PlatformValidator func(string) error
  97. // DefaultDailyUsageUsd holds the default value on creation for the "daily_usage_usd" field.
  98. DefaultDailyUsageUsd float64
  99. // DefaultWeeklyUsageUsd holds the default value on creation for the "weekly_usage_usd" field.
  100. DefaultWeeklyUsageUsd float64
  101. // DefaultMonthlyUsageUsd holds the default value on creation for the "monthly_usage_usd" field.
  102. DefaultMonthlyUsageUsd float64
  103. )
  104. // OrderOption defines the ordering options for the UserPlatformQuota queries.
  105. type OrderOption func(*sql.Selector)
  106. // ByID orders the results by the id field.
  107. func ByID(opts ...sql.OrderTermOption) OrderOption {
  108. return sql.OrderByField(FieldID, opts...).ToFunc()
  109. }
  110. // ByCreatedAt orders the results by the created_at field.
  111. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  112. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  113. }
  114. // ByUpdatedAt orders the results by the updated_at field.
  115. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  116. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  117. }
  118. // ByDeletedAt orders the results by the deleted_at field.
  119. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  120. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  121. }
  122. // ByUserID orders the results by the user_id field.
  123. func ByUserID(opts ...sql.OrderTermOption) OrderOption {
  124. return sql.OrderByField(FieldUserID, opts...).ToFunc()
  125. }
  126. // ByPlatform orders the results by the platform field.
  127. func ByPlatform(opts ...sql.OrderTermOption) OrderOption {
  128. return sql.OrderByField(FieldPlatform, opts...).ToFunc()
  129. }
  130. // ByDailyLimitUsd orders the results by the daily_limit_usd field.
  131. func ByDailyLimitUsd(opts ...sql.OrderTermOption) OrderOption {
  132. return sql.OrderByField(FieldDailyLimitUsd, opts...).ToFunc()
  133. }
  134. // ByWeeklyLimitUsd orders the results by the weekly_limit_usd field.
  135. func ByWeeklyLimitUsd(opts ...sql.OrderTermOption) OrderOption {
  136. return sql.OrderByField(FieldWeeklyLimitUsd, opts...).ToFunc()
  137. }
  138. // ByMonthlyLimitUsd orders the results by the monthly_limit_usd field.
  139. func ByMonthlyLimitUsd(opts ...sql.OrderTermOption) OrderOption {
  140. return sql.OrderByField(FieldMonthlyLimitUsd, opts...).ToFunc()
  141. }
  142. // ByDailyUsageUsd orders the results by the daily_usage_usd field.
  143. func ByDailyUsageUsd(opts ...sql.OrderTermOption) OrderOption {
  144. return sql.OrderByField(FieldDailyUsageUsd, opts...).ToFunc()
  145. }
  146. // ByWeeklyUsageUsd orders the results by the weekly_usage_usd field.
  147. func ByWeeklyUsageUsd(opts ...sql.OrderTermOption) OrderOption {
  148. return sql.OrderByField(FieldWeeklyUsageUsd, opts...).ToFunc()
  149. }
  150. // ByMonthlyUsageUsd orders the results by the monthly_usage_usd field.
  151. func ByMonthlyUsageUsd(opts ...sql.OrderTermOption) OrderOption {
  152. return sql.OrderByField(FieldMonthlyUsageUsd, opts...).ToFunc()
  153. }
  154. // ByDailyWindowStart orders the results by the daily_window_start field.
  155. func ByDailyWindowStart(opts ...sql.OrderTermOption) OrderOption {
  156. return sql.OrderByField(FieldDailyWindowStart, opts...).ToFunc()
  157. }
  158. // ByWeeklyWindowStart orders the results by the weekly_window_start field.
  159. func ByWeeklyWindowStart(opts ...sql.OrderTermOption) OrderOption {
  160. return sql.OrderByField(FieldWeeklyWindowStart, opts...).ToFunc()
  161. }
  162. // ByMonthlyWindowStart orders the results by the monthly_window_start field.
  163. func ByMonthlyWindowStart(opts ...sql.OrderTermOption) OrderOption {
  164. return sql.OrderByField(FieldMonthlyWindowStart, opts...).ToFunc()
  165. }
  166. // ByUserField orders the results by user field.
  167. func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
  168. return func(s *sql.Selector) {
  169. sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
  170. }
  171. }
  172. func newUserStep() *sqlgraph.Step {
  173. return sqlgraph.NewStep(
  174. sqlgraph.From(Table, FieldID),
  175. sqlgraph.To(UserInverseTable, FieldID),
  176. sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
  177. )
  178. }