idempotencyrecord.go 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // Code generated by ent, DO NOT EDIT.
  2. package idempotencyrecord
  3. import (
  4. "time"
  5. "entgo.io/ent/dialect/sql"
  6. )
  7. const (
  8. // Label holds the string label denoting the idempotencyrecord type in the database.
  9. Label = "idempotency_record"
  10. // FieldID holds the string denoting the id field in the database.
  11. FieldID = "id"
  12. // FieldCreatedAt holds the string denoting the created_at field in the database.
  13. FieldCreatedAt = "created_at"
  14. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  15. FieldUpdatedAt = "updated_at"
  16. // FieldScope holds the string denoting the scope field in the database.
  17. FieldScope = "scope"
  18. // FieldIdempotencyKeyHash holds the string denoting the idempotency_key_hash field in the database.
  19. FieldIdempotencyKeyHash = "idempotency_key_hash"
  20. // FieldRequestFingerprint holds the string denoting the request_fingerprint field in the database.
  21. FieldRequestFingerprint = "request_fingerprint"
  22. // FieldStatus holds the string denoting the status field in the database.
  23. FieldStatus = "status"
  24. // FieldResponseStatus holds the string denoting the response_status field in the database.
  25. FieldResponseStatus = "response_status"
  26. // FieldResponseBody holds the string denoting the response_body field in the database.
  27. FieldResponseBody = "response_body"
  28. // FieldErrorReason holds the string denoting the error_reason field in the database.
  29. FieldErrorReason = "error_reason"
  30. // FieldLockedUntil holds the string denoting the locked_until field in the database.
  31. FieldLockedUntil = "locked_until"
  32. // FieldExpiresAt holds the string denoting the expires_at field in the database.
  33. FieldExpiresAt = "expires_at"
  34. // Table holds the table name of the idempotencyrecord in the database.
  35. Table = "idempotency_records"
  36. )
  37. // Columns holds all SQL columns for idempotencyrecord fields.
  38. var Columns = []string{
  39. FieldID,
  40. FieldCreatedAt,
  41. FieldUpdatedAt,
  42. FieldScope,
  43. FieldIdempotencyKeyHash,
  44. FieldRequestFingerprint,
  45. FieldStatus,
  46. FieldResponseStatus,
  47. FieldResponseBody,
  48. FieldErrorReason,
  49. FieldLockedUntil,
  50. FieldExpiresAt,
  51. }
  52. // ValidColumn reports if the column name is valid (part of the table columns).
  53. func ValidColumn(column string) bool {
  54. for i := range Columns {
  55. if column == Columns[i] {
  56. return true
  57. }
  58. }
  59. return false
  60. }
  61. var (
  62. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  63. DefaultCreatedAt func() time.Time
  64. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  65. DefaultUpdatedAt func() time.Time
  66. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  67. UpdateDefaultUpdatedAt func() time.Time
  68. // ScopeValidator is a validator for the "scope" field. It is called by the builders before save.
  69. ScopeValidator func(string) error
  70. // IdempotencyKeyHashValidator is a validator for the "idempotency_key_hash" field. It is called by the builders before save.
  71. IdempotencyKeyHashValidator func(string) error
  72. // RequestFingerprintValidator is a validator for the "request_fingerprint" field. It is called by the builders before save.
  73. RequestFingerprintValidator func(string) error
  74. // StatusValidator is a validator for the "status" field. It is called by the builders before save.
  75. StatusValidator func(string) error
  76. // ErrorReasonValidator is a validator for the "error_reason" field. It is called by the builders before save.
  77. ErrorReasonValidator func(string) error
  78. )
  79. // OrderOption defines the ordering options for the IdempotencyRecord queries.
  80. type OrderOption func(*sql.Selector)
  81. // ByID orders the results by the id field.
  82. func ByID(opts ...sql.OrderTermOption) OrderOption {
  83. return sql.OrderByField(FieldID, opts...).ToFunc()
  84. }
  85. // ByCreatedAt orders the results by the created_at field.
  86. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  87. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  88. }
  89. // ByUpdatedAt orders the results by the updated_at field.
  90. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  91. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  92. }
  93. // ByScope orders the results by the scope field.
  94. func ByScope(opts ...sql.OrderTermOption) OrderOption {
  95. return sql.OrderByField(FieldScope, opts...).ToFunc()
  96. }
  97. // ByIdempotencyKeyHash orders the results by the idempotency_key_hash field.
  98. func ByIdempotencyKeyHash(opts ...sql.OrderTermOption) OrderOption {
  99. return sql.OrderByField(FieldIdempotencyKeyHash, opts...).ToFunc()
  100. }
  101. // ByRequestFingerprint orders the results by the request_fingerprint field.
  102. func ByRequestFingerprint(opts ...sql.OrderTermOption) OrderOption {
  103. return sql.OrderByField(FieldRequestFingerprint, 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. // ByResponseStatus orders the results by the response_status field.
  110. func ByResponseStatus(opts ...sql.OrderTermOption) OrderOption {
  111. return sql.OrderByField(FieldResponseStatus, opts...).ToFunc()
  112. }
  113. // ByResponseBody orders the results by the response_body field.
  114. func ByResponseBody(opts ...sql.OrderTermOption) OrderOption {
  115. return sql.OrderByField(FieldResponseBody, opts...).ToFunc()
  116. }
  117. // ByErrorReason orders the results by the error_reason field.
  118. func ByErrorReason(opts ...sql.OrderTermOption) OrderOption {
  119. return sql.OrderByField(FieldErrorReason, opts...).ToFunc()
  120. }
  121. // ByLockedUntil orders the results by the locked_until field.
  122. func ByLockedUntil(opts ...sql.OrderTermOption) OrderOption {
  123. return sql.OrderByField(FieldLockedUntil, opts...).ToFunc()
  124. }
  125. // ByExpiresAt orders the results by the expires_at field.
  126. func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
  127. return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
  128. }