paymentorder.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. // Code generated by ent, DO NOT EDIT.
  2. package paymentorder
  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 paymentorder type in the database.
  10. Label = "payment_order"
  11. // FieldID holds the string denoting the id field in the database.
  12. FieldID = "id"
  13. // FieldUserID holds the string denoting the user_id field in the database.
  14. FieldUserID = "user_id"
  15. // FieldUserEmail holds the string denoting the user_email field in the database.
  16. FieldUserEmail = "user_email"
  17. // FieldUserName holds the string denoting the user_name field in the database.
  18. FieldUserName = "user_name"
  19. // FieldUserNotes holds the string denoting the user_notes field in the database.
  20. FieldUserNotes = "user_notes"
  21. // FieldAmount holds the string denoting the amount field in the database.
  22. FieldAmount = "amount"
  23. // FieldPayAmount holds the string denoting the pay_amount field in the database.
  24. FieldPayAmount = "pay_amount"
  25. // FieldFeeRate holds the string denoting the fee_rate field in the database.
  26. FieldFeeRate = "fee_rate"
  27. // FieldRechargeCode holds the string denoting the recharge_code field in the database.
  28. FieldRechargeCode = "recharge_code"
  29. // FieldOutTradeNo holds the string denoting the out_trade_no field in the database.
  30. FieldOutTradeNo = "out_trade_no"
  31. // FieldPaymentType holds the string denoting the payment_type field in the database.
  32. FieldPaymentType = "payment_type"
  33. // FieldPaymentTradeNo holds the string denoting the payment_trade_no field in the database.
  34. FieldPaymentTradeNo = "payment_trade_no"
  35. // FieldPayURL holds the string denoting the pay_url field in the database.
  36. FieldPayURL = "pay_url"
  37. // FieldQrCode holds the string denoting the qr_code field in the database.
  38. FieldQrCode = "qr_code"
  39. // FieldQrCodeImg holds the string denoting the qr_code_img field in the database.
  40. FieldQrCodeImg = "qr_code_img"
  41. // FieldOrderType holds the string denoting the order_type field in the database.
  42. FieldOrderType = "order_type"
  43. // FieldPlanID holds the string denoting the plan_id field in the database.
  44. FieldPlanID = "plan_id"
  45. // FieldSubscriptionGroupID holds the string denoting the subscription_group_id field in the database.
  46. FieldSubscriptionGroupID = "subscription_group_id"
  47. // FieldSubscriptionDays holds the string denoting the subscription_days field in the database.
  48. FieldSubscriptionDays = "subscription_days"
  49. // FieldProviderInstanceID holds the string denoting the provider_instance_id field in the database.
  50. FieldProviderInstanceID = "provider_instance_id"
  51. // FieldProviderKey holds the string denoting the provider_key field in the database.
  52. FieldProviderKey = "provider_key"
  53. // FieldProviderSnapshot holds the string denoting the provider_snapshot field in the database.
  54. FieldProviderSnapshot = "provider_snapshot"
  55. // FieldStatus holds the string denoting the status field in the database.
  56. FieldStatus = "status"
  57. // FieldRefundAmount holds the string denoting the refund_amount field in the database.
  58. FieldRefundAmount = "refund_amount"
  59. // FieldRefundReason holds the string denoting the refund_reason field in the database.
  60. FieldRefundReason = "refund_reason"
  61. // FieldRefundAt holds the string denoting the refund_at field in the database.
  62. FieldRefundAt = "refund_at"
  63. // FieldForceRefund holds the string denoting the force_refund field in the database.
  64. FieldForceRefund = "force_refund"
  65. // FieldRefundRequestedAt holds the string denoting the refund_requested_at field in the database.
  66. FieldRefundRequestedAt = "refund_requested_at"
  67. // FieldRefundRequestReason holds the string denoting the refund_request_reason field in the database.
  68. FieldRefundRequestReason = "refund_request_reason"
  69. // FieldRefundRequestedBy holds the string denoting the refund_requested_by field in the database.
  70. FieldRefundRequestedBy = "refund_requested_by"
  71. // FieldExpiresAt holds the string denoting the expires_at field in the database.
  72. FieldExpiresAt = "expires_at"
  73. // FieldPaidAt holds the string denoting the paid_at field in the database.
  74. FieldPaidAt = "paid_at"
  75. // FieldCompletedAt holds the string denoting the completed_at field in the database.
  76. FieldCompletedAt = "completed_at"
  77. // FieldFailedAt holds the string denoting the failed_at field in the database.
  78. FieldFailedAt = "failed_at"
  79. // FieldFailedReason holds the string denoting the failed_reason field in the database.
  80. FieldFailedReason = "failed_reason"
  81. // FieldClientIP holds the string denoting the client_ip field in the database.
  82. FieldClientIP = "client_ip"
  83. // FieldSrcHost holds the string denoting the src_host field in the database.
  84. FieldSrcHost = "src_host"
  85. // FieldSrcURL holds the string denoting the src_url field in the database.
  86. FieldSrcURL = "src_url"
  87. // FieldCreatedAt holds the string denoting the created_at field in the database.
  88. FieldCreatedAt = "created_at"
  89. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  90. FieldUpdatedAt = "updated_at"
  91. // EdgeUser holds the string denoting the user edge name in mutations.
  92. EdgeUser = "user"
  93. // Table holds the table name of the paymentorder in the database.
  94. Table = "payment_orders"
  95. // UserTable is the table that holds the user relation/edge.
  96. UserTable = "payment_orders"
  97. // UserInverseTable is the table name for the User entity.
  98. // It exists in this package in order to avoid circular dependency with the "user" package.
  99. UserInverseTable = "users"
  100. // UserColumn is the table column denoting the user relation/edge.
  101. UserColumn = "user_id"
  102. )
  103. // Columns holds all SQL columns for paymentorder fields.
  104. var Columns = []string{
  105. FieldID,
  106. FieldUserID,
  107. FieldUserEmail,
  108. FieldUserName,
  109. FieldUserNotes,
  110. FieldAmount,
  111. FieldPayAmount,
  112. FieldFeeRate,
  113. FieldRechargeCode,
  114. FieldOutTradeNo,
  115. FieldPaymentType,
  116. FieldPaymentTradeNo,
  117. FieldPayURL,
  118. FieldQrCode,
  119. FieldQrCodeImg,
  120. FieldOrderType,
  121. FieldPlanID,
  122. FieldSubscriptionGroupID,
  123. FieldSubscriptionDays,
  124. FieldProviderInstanceID,
  125. FieldProviderKey,
  126. FieldProviderSnapshot,
  127. FieldStatus,
  128. FieldRefundAmount,
  129. FieldRefundReason,
  130. FieldRefundAt,
  131. FieldForceRefund,
  132. FieldRefundRequestedAt,
  133. FieldRefundRequestReason,
  134. FieldRefundRequestedBy,
  135. FieldExpiresAt,
  136. FieldPaidAt,
  137. FieldCompletedAt,
  138. FieldFailedAt,
  139. FieldFailedReason,
  140. FieldClientIP,
  141. FieldSrcHost,
  142. FieldSrcURL,
  143. FieldCreatedAt,
  144. FieldUpdatedAt,
  145. }
  146. // ValidColumn reports if the column name is valid (part of the table columns).
  147. func ValidColumn(column string) bool {
  148. for i := range Columns {
  149. if column == Columns[i] {
  150. return true
  151. }
  152. }
  153. return false
  154. }
  155. var (
  156. // UserEmailValidator is a validator for the "user_email" field. It is called by the builders before save.
  157. UserEmailValidator func(string) error
  158. // UserNameValidator is a validator for the "user_name" field. It is called by the builders before save.
  159. UserNameValidator func(string) error
  160. // DefaultFeeRate holds the default value on creation for the "fee_rate" field.
  161. DefaultFeeRate float64
  162. // RechargeCodeValidator is a validator for the "recharge_code" field. It is called by the builders before save.
  163. RechargeCodeValidator func(string) error
  164. // DefaultOutTradeNo holds the default value on creation for the "out_trade_no" field.
  165. DefaultOutTradeNo string
  166. // OutTradeNoValidator is a validator for the "out_trade_no" field. It is called by the builders before save.
  167. OutTradeNoValidator func(string) error
  168. // PaymentTypeValidator is a validator for the "payment_type" field. It is called by the builders before save.
  169. PaymentTypeValidator func(string) error
  170. // PaymentTradeNoValidator is a validator for the "payment_trade_no" field. It is called by the builders before save.
  171. PaymentTradeNoValidator func(string) error
  172. // DefaultOrderType holds the default value on creation for the "order_type" field.
  173. DefaultOrderType string
  174. // OrderTypeValidator is a validator for the "order_type" field. It is called by the builders before save.
  175. OrderTypeValidator func(string) error
  176. // ProviderInstanceIDValidator is a validator for the "provider_instance_id" field. It is called by the builders before save.
  177. ProviderInstanceIDValidator func(string) error
  178. // ProviderKeyValidator is a validator for the "provider_key" field. It is called by the builders before save.
  179. ProviderKeyValidator func(string) error
  180. // DefaultStatus holds the default value on creation for the "status" field.
  181. DefaultStatus string
  182. // StatusValidator is a validator for the "status" field. It is called by the builders before save.
  183. StatusValidator func(string) error
  184. // DefaultRefundAmount holds the default value on creation for the "refund_amount" field.
  185. DefaultRefundAmount float64
  186. // DefaultForceRefund holds the default value on creation for the "force_refund" field.
  187. DefaultForceRefund bool
  188. // RefundRequestedByValidator is a validator for the "refund_requested_by" field. It is called by the builders before save.
  189. RefundRequestedByValidator func(string) error
  190. // ClientIPValidator is a validator for the "client_ip" field. It is called by the builders before save.
  191. ClientIPValidator func(string) error
  192. // SrcHostValidator is a validator for the "src_host" field. It is called by the builders before save.
  193. SrcHostValidator func(string) error
  194. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  195. DefaultCreatedAt func() time.Time
  196. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  197. DefaultUpdatedAt func() time.Time
  198. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  199. UpdateDefaultUpdatedAt func() time.Time
  200. )
  201. // OrderOption defines the ordering options for the PaymentOrder queries.
  202. type OrderOption func(*sql.Selector)
  203. // ByID orders the results by the id field.
  204. func ByID(opts ...sql.OrderTermOption) OrderOption {
  205. return sql.OrderByField(FieldID, opts...).ToFunc()
  206. }
  207. // ByUserID orders the results by the user_id field.
  208. func ByUserID(opts ...sql.OrderTermOption) OrderOption {
  209. return sql.OrderByField(FieldUserID, opts...).ToFunc()
  210. }
  211. // ByUserEmail orders the results by the user_email field.
  212. func ByUserEmail(opts ...sql.OrderTermOption) OrderOption {
  213. return sql.OrderByField(FieldUserEmail, opts...).ToFunc()
  214. }
  215. // ByUserName orders the results by the user_name field.
  216. func ByUserName(opts ...sql.OrderTermOption) OrderOption {
  217. return sql.OrderByField(FieldUserName, opts...).ToFunc()
  218. }
  219. // ByUserNotes orders the results by the user_notes field.
  220. func ByUserNotes(opts ...sql.OrderTermOption) OrderOption {
  221. return sql.OrderByField(FieldUserNotes, opts...).ToFunc()
  222. }
  223. // ByAmount orders the results by the amount field.
  224. func ByAmount(opts ...sql.OrderTermOption) OrderOption {
  225. return sql.OrderByField(FieldAmount, opts...).ToFunc()
  226. }
  227. // ByPayAmount orders the results by the pay_amount field.
  228. func ByPayAmount(opts ...sql.OrderTermOption) OrderOption {
  229. return sql.OrderByField(FieldPayAmount, opts...).ToFunc()
  230. }
  231. // ByFeeRate orders the results by the fee_rate field.
  232. func ByFeeRate(opts ...sql.OrderTermOption) OrderOption {
  233. return sql.OrderByField(FieldFeeRate, opts...).ToFunc()
  234. }
  235. // ByRechargeCode orders the results by the recharge_code field.
  236. func ByRechargeCode(opts ...sql.OrderTermOption) OrderOption {
  237. return sql.OrderByField(FieldRechargeCode, opts...).ToFunc()
  238. }
  239. // ByOutTradeNo orders the results by the out_trade_no field.
  240. func ByOutTradeNo(opts ...sql.OrderTermOption) OrderOption {
  241. return sql.OrderByField(FieldOutTradeNo, opts...).ToFunc()
  242. }
  243. // ByPaymentType orders the results by the payment_type field.
  244. func ByPaymentType(opts ...sql.OrderTermOption) OrderOption {
  245. return sql.OrderByField(FieldPaymentType, opts...).ToFunc()
  246. }
  247. // ByPaymentTradeNo orders the results by the payment_trade_no field.
  248. func ByPaymentTradeNo(opts ...sql.OrderTermOption) OrderOption {
  249. return sql.OrderByField(FieldPaymentTradeNo, opts...).ToFunc()
  250. }
  251. // ByPayURL orders the results by the pay_url field.
  252. func ByPayURL(opts ...sql.OrderTermOption) OrderOption {
  253. return sql.OrderByField(FieldPayURL, opts...).ToFunc()
  254. }
  255. // ByQrCode orders the results by the qr_code field.
  256. func ByQrCode(opts ...sql.OrderTermOption) OrderOption {
  257. return sql.OrderByField(FieldQrCode, opts...).ToFunc()
  258. }
  259. // ByQrCodeImg orders the results by the qr_code_img field.
  260. func ByQrCodeImg(opts ...sql.OrderTermOption) OrderOption {
  261. return sql.OrderByField(FieldQrCodeImg, opts...).ToFunc()
  262. }
  263. // ByOrderType orders the results by the order_type field.
  264. func ByOrderType(opts ...sql.OrderTermOption) OrderOption {
  265. return sql.OrderByField(FieldOrderType, opts...).ToFunc()
  266. }
  267. // ByPlanID orders the results by the plan_id field.
  268. func ByPlanID(opts ...sql.OrderTermOption) OrderOption {
  269. return sql.OrderByField(FieldPlanID, opts...).ToFunc()
  270. }
  271. // BySubscriptionGroupID orders the results by the subscription_group_id field.
  272. func BySubscriptionGroupID(opts ...sql.OrderTermOption) OrderOption {
  273. return sql.OrderByField(FieldSubscriptionGroupID, opts...).ToFunc()
  274. }
  275. // BySubscriptionDays orders the results by the subscription_days field.
  276. func BySubscriptionDays(opts ...sql.OrderTermOption) OrderOption {
  277. return sql.OrderByField(FieldSubscriptionDays, opts...).ToFunc()
  278. }
  279. // ByProviderInstanceID orders the results by the provider_instance_id field.
  280. func ByProviderInstanceID(opts ...sql.OrderTermOption) OrderOption {
  281. return sql.OrderByField(FieldProviderInstanceID, opts...).ToFunc()
  282. }
  283. // ByProviderKey orders the results by the provider_key field.
  284. func ByProviderKey(opts ...sql.OrderTermOption) OrderOption {
  285. return sql.OrderByField(FieldProviderKey, opts...).ToFunc()
  286. }
  287. // ByStatus orders the results by the status field.
  288. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  289. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  290. }
  291. // ByRefundAmount orders the results by the refund_amount field.
  292. func ByRefundAmount(opts ...sql.OrderTermOption) OrderOption {
  293. return sql.OrderByField(FieldRefundAmount, opts...).ToFunc()
  294. }
  295. // ByRefundReason orders the results by the refund_reason field.
  296. func ByRefundReason(opts ...sql.OrderTermOption) OrderOption {
  297. return sql.OrderByField(FieldRefundReason, opts...).ToFunc()
  298. }
  299. // ByRefundAt orders the results by the refund_at field.
  300. func ByRefundAt(opts ...sql.OrderTermOption) OrderOption {
  301. return sql.OrderByField(FieldRefundAt, opts...).ToFunc()
  302. }
  303. // ByForceRefund orders the results by the force_refund field.
  304. func ByForceRefund(opts ...sql.OrderTermOption) OrderOption {
  305. return sql.OrderByField(FieldForceRefund, opts...).ToFunc()
  306. }
  307. // ByRefundRequestedAt orders the results by the refund_requested_at field.
  308. func ByRefundRequestedAt(opts ...sql.OrderTermOption) OrderOption {
  309. return sql.OrderByField(FieldRefundRequestedAt, opts...).ToFunc()
  310. }
  311. // ByRefundRequestReason orders the results by the refund_request_reason field.
  312. func ByRefundRequestReason(opts ...sql.OrderTermOption) OrderOption {
  313. return sql.OrderByField(FieldRefundRequestReason, opts...).ToFunc()
  314. }
  315. // ByRefundRequestedBy orders the results by the refund_requested_by field.
  316. func ByRefundRequestedBy(opts ...sql.OrderTermOption) OrderOption {
  317. return sql.OrderByField(FieldRefundRequestedBy, opts...).ToFunc()
  318. }
  319. // ByExpiresAt orders the results by the expires_at field.
  320. func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
  321. return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
  322. }
  323. // ByPaidAt orders the results by the paid_at field.
  324. func ByPaidAt(opts ...sql.OrderTermOption) OrderOption {
  325. return sql.OrderByField(FieldPaidAt, opts...).ToFunc()
  326. }
  327. // ByCompletedAt orders the results by the completed_at field.
  328. func ByCompletedAt(opts ...sql.OrderTermOption) OrderOption {
  329. return sql.OrderByField(FieldCompletedAt, opts...).ToFunc()
  330. }
  331. // ByFailedAt orders the results by the failed_at field.
  332. func ByFailedAt(opts ...sql.OrderTermOption) OrderOption {
  333. return sql.OrderByField(FieldFailedAt, opts...).ToFunc()
  334. }
  335. // ByFailedReason orders the results by the failed_reason field.
  336. func ByFailedReason(opts ...sql.OrderTermOption) OrderOption {
  337. return sql.OrderByField(FieldFailedReason, opts...).ToFunc()
  338. }
  339. // ByClientIP orders the results by the client_ip field.
  340. func ByClientIP(opts ...sql.OrderTermOption) OrderOption {
  341. return sql.OrderByField(FieldClientIP, opts...).ToFunc()
  342. }
  343. // BySrcHost orders the results by the src_host field.
  344. func BySrcHost(opts ...sql.OrderTermOption) OrderOption {
  345. return sql.OrderByField(FieldSrcHost, opts...).ToFunc()
  346. }
  347. // BySrcURL orders the results by the src_url field.
  348. func BySrcURL(opts ...sql.OrderTermOption) OrderOption {
  349. return sql.OrderByField(FieldSrcURL, opts...).ToFunc()
  350. }
  351. // ByCreatedAt orders the results by the created_at field.
  352. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  353. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  354. }
  355. // ByUpdatedAt orders the results by the updated_at field.
  356. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  357. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  358. }
  359. // ByUserField orders the results by user field.
  360. func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
  361. return func(s *sql.Selector) {
  362. sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
  363. }
  364. }
  365. func newUserStep() *sqlgraph.Step {
  366. return sqlgraph.NewStep(
  367. sqlgraph.From(Table, FieldID),
  368. sqlgraph.To(UserInverseTable, FieldID),
  369. sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
  370. )
  371. }