subscriptionplan.go 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. // Code generated by ent, DO NOT EDIT.
  2. package subscriptionplan
  3. import (
  4. "time"
  5. "entgo.io/ent/dialect/sql"
  6. )
  7. const (
  8. // Label holds the string label denoting the subscriptionplan type in the database.
  9. Label = "subscription_plan"
  10. // FieldID holds the string denoting the id field in the database.
  11. FieldID = "id"
  12. // FieldGroupID holds the string denoting the group_id field in the database.
  13. FieldGroupID = "group_id"
  14. // FieldName holds the string denoting the name field in the database.
  15. FieldName = "name"
  16. // FieldDescription holds the string denoting the description field in the database.
  17. FieldDescription = "description"
  18. // FieldPrice holds the string denoting the price field in the database.
  19. FieldPrice = "price"
  20. // FieldOriginalPrice holds the string denoting the original_price field in the database.
  21. FieldOriginalPrice = "original_price"
  22. // FieldCurrency holds the string denoting the currency field in the database.
  23. FieldCurrency = "currency"
  24. // FieldValidityDays holds the string denoting the validity_days field in the database.
  25. FieldValidityDays = "validity_days"
  26. // FieldValidityUnit holds the string denoting the validity_unit field in the database.
  27. FieldValidityUnit = "validity_unit"
  28. // FieldFeatures holds the string denoting the features field in the database.
  29. FieldFeatures = "features"
  30. // FieldProductName holds the string denoting the product_name field in the database.
  31. FieldProductName = "product_name"
  32. // FieldForSale holds the string denoting the for_sale field in the database.
  33. FieldForSale = "for_sale"
  34. // FieldSortOrder holds the string denoting the sort_order field in the database.
  35. FieldSortOrder = "sort_order"
  36. // FieldCreatedAt holds the string denoting the created_at field in the database.
  37. FieldCreatedAt = "created_at"
  38. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  39. FieldUpdatedAt = "updated_at"
  40. // Table holds the table name of the subscriptionplan in the database.
  41. Table = "subscription_plans"
  42. )
  43. // Columns holds all SQL columns for subscriptionplan fields.
  44. var Columns = []string{
  45. FieldID,
  46. FieldGroupID,
  47. FieldName,
  48. FieldDescription,
  49. FieldPrice,
  50. FieldOriginalPrice,
  51. FieldCurrency,
  52. FieldValidityDays,
  53. FieldValidityUnit,
  54. FieldFeatures,
  55. FieldProductName,
  56. FieldForSale,
  57. FieldSortOrder,
  58. FieldCreatedAt,
  59. FieldUpdatedAt,
  60. }
  61. // ValidColumn reports if the column name is valid (part of the table columns).
  62. func ValidColumn(column string) bool {
  63. for i := range Columns {
  64. if column == Columns[i] {
  65. return true
  66. }
  67. }
  68. return false
  69. }
  70. var (
  71. // NameValidator is a validator for the "name" field. It is called by the builders before save.
  72. NameValidator func(string) error
  73. // DefaultDescription holds the default value on creation for the "description" field.
  74. DefaultDescription string
  75. // DefaultCurrency holds the default value on creation for the "currency" field.
  76. DefaultCurrency string
  77. // CurrencyValidator is a validator for the "currency" field. It is called by the builders before save.
  78. CurrencyValidator func(string) error
  79. // DefaultValidityDays holds the default value on creation for the "validity_days" field.
  80. DefaultValidityDays int
  81. // DefaultValidityUnit holds the default value on creation for the "validity_unit" field.
  82. DefaultValidityUnit string
  83. // ValidityUnitValidator is a validator for the "validity_unit" field. It is called by the builders before save.
  84. ValidityUnitValidator func(string) error
  85. // DefaultFeatures holds the default value on creation for the "features" field.
  86. DefaultFeatures string
  87. // DefaultProductName holds the default value on creation for the "product_name" field.
  88. DefaultProductName string
  89. // ProductNameValidator is a validator for the "product_name" field. It is called by the builders before save.
  90. ProductNameValidator func(string) error
  91. // DefaultForSale holds the default value on creation for the "for_sale" field.
  92. DefaultForSale bool
  93. // DefaultSortOrder holds the default value on creation for the "sort_order" field.
  94. DefaultSortOrder int
  95. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  96. DefaultCreatedAt func() time.Time
  97. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  98. DefaultUpdatedAt func() time.Time
  99. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  100. UpdateDefaultUpdatedAt func() time.Time
  101. )
  102. // OrderOption defines the ordering options for the SubscriptionPlan queries.
  103. type OrderOption func(*sql.Selector)
  104. // ByID orders the results by the id field.
  105. func ByID(opts ...sql.OrderTermOption) OrderOption {
  106. return sql.OrderByField(FieldID, opts...).ToFunc()
  107. }
  108. // ByGroupID orders the results by the group_id field.
  109. func ByGroupID(opts ...sql.OrderTermOption) OrderOption {
  110. return sql.OrderByField(FieldGroupID, opts...).ToFunc()
  111. }
  112. // ByName orders the results by the name field.
  113. func ByName(opts ...sql.OrderTermOption) OrderOption {
  114. return sql.OrderByField(FieldName, opts...).ToFunc()
  115. }
  116. // ByDescription orders the results by the description field.
  117. func ByDescription(opts ...sql.OrderTermOption) OrderOption {
  118. return sql.OrderByField(FieldDescription, opts...).ToFunc()
  119. }
  120. // ByPrice orders the results by the price field.
  121. func ByPrice(opts ...sql.OrderTermOption) OrderOption {
  122. return sql.OrderByField(FieldPrice, opts...).ToFunc()
  123. }
  124. // ByOriginalPrice orders the results by the original_price field.
  125. func ByOriginalPrice(opts ...sql.OrderTermOption) OrderOption {
  126. return sql.OrderByField(FieldOriginalPrice, opts...).ToFunc()
  127. }
  128. // ByCurrency orders the results by the currency field.
  129. func ByCurrency(opts ...sql.OrderTermOption) OrderOption {
  130. return sql.OrderByField(FieldCurrency, opts...).ToFunc()
  131. }
  132. // ByValidityDays orders the results by the validity_days field.
  133. func ByValidityDays(opts ...sql.OrderTermOption) OrderOption {
  134. return sql.OrderByField(FieldValidityDays, opts...).ToFunc()
  135. }
  136. // ByValidityUnit orders the results by the validity_unit field.
  137. func ByValidityUnit(opts ...sql.OrderTermOption) OrderOption {
  138. return sql.OrderByField(FieldValidityUnit, opts...).ToFunc()
  139. }
  140. // ByFeatures orders the results by the features field.
  141. func ByFeatures(opts ...sql.OrderTermOption) OrderOption {
  142. return sql.OrderByField(FieldFeatures, opts...).ToFunc()
  143. }
  144. // ByProductName orders the results by the product_name field.
  145. func ByProductName(opts ...sql.OrderTermOption) OrderOption {
  146. return sql.OrderByField(FieldProductName, opts...).ToFunc()
  147. }
  148. // ByForSale orders the results by the for_sale field.
  149. func ByForSale(opts ...sql.OrderTermOption) OrderOption {
  150. return sql.OrderByField(FieldForSale, opts...).ToFunc()
  151. }
  152. // BySortOrder orders the results by the sort_order field.
  153. func BySortOrder(opts ...sql.OrderTermOption) OrderOption {
  154. return sql.OrderByField(FieldSortOrder, opts...).ToFunc()
  155. }
  156. // ByCreatedAt orders the results by the created_at field.
  157. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  158. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  159. }
  160. // ByUpdatedAt orders the results by the updated_at field.
  161. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  162. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  163. }