pendingauthsession.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. // Code generated by ent, DO NOT EDIT.
  2. package pendingauthsession
  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 pendingauthsession type in the database.
  10. Label = "pending_auth_session"
  11. // FieldID holds the string denoting the id field in the database.
  12. FieldID = "id"
  13. // FieldCreatedAt holds the string denoting the created_at field in the database.
  14. FieldCreatedAt = "created_at"
  15. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  16. FieldUpdatedAt = "updated_at"
  17. // FieldSessionToken holds the string denoting the session_token field in the database.
  18. FieldSessionToken = "session_token"
  19. // FieldIntent holds the string denoting the intent field in the database.
  20. FieldIntent = "intent"
  21. // FieldProviderType holds the string denoting the provider_type field in the database.
  22. FieldProviderType = "provider_type"
  23. // FieldProviderKey holds the string denoting the provider_key field in the database.
  24. FieldProviderKey = "provider_key"
  25. // FieldProviderSubject holds the string denoting the provider_subject field in the database.
  26. FieldProviderSubject = "provider_subject"
  27. // FieldTargetUserID holds the string denoting the target_user_id field in the database.
  28. FieldTargetUserID = "target_user_id"
  29. // FieldRedirectTo holds the string denoting the redirect_to field in the database.
  30. FieldRedirectTo = "redirect_to"
  31. // FieldResolvedEmail holds the string denoting the resolved_email field in the database.
  32. FieldResolvedEmail = "resolved_email"
  33. // FieldRegistrationPasswordHash holds the string denoting the registration_password_hash field in the database.
  34. FieldRegistrationPasswordHash = "registration_password_hash"
  35. // FieldUpstreamIdentityClaims holds the string denoting the upstream_identity_claims field in the database.
  36. FieldUpstreamIdentityClaims = "upstream_identity_claims"
  37. // FieldLocalFlowState holds the string denoting the local_flow_state field in the database.
  38. FieldLocalFlowState = "local_flow_state"
  39. // FieldBrowserSessionKey holds the string denoting the browser_session_key field in the database.
  40. FieldBrowserSessionKey = "browser_session_key"
  41. // FieldCompletionCodeHash holds the string denoting the completion_code_hash field in the database.
  42. FieldCompletionCodeHash = "completion_code_hash"
  43. // FieldCompletionCodeExpiresAt holds the string denoting the completion_code_expires_at field in the database.
  44. FieldCompletionCodeExpiresAt = "completion_code_expires_at"
  45. // FieldEmailVerifiedAt holds the string denoting the email_verified_at field in the database.
  46. FieldEmailVerifiedAt = "email_verified_at"
  47. // FieldPasswordVerifiedAt holds the string denoting the password_verified_at field in the database.
  48. FieldPasswordVerifiedAt = "password_verified_at"
  49. // FieldTotpVerifiedAt holds the string denoting the totp_verified_at field in the database.
  50. FieldTotpVerifiedAt = "totp_verified_at"
  51. // FieldExpiresAt holds the string denoting the expires_at field in the database.
  52. FieldExpiresAt = "expires_at"
  53. // FieldConsumedAt holds the string denoting the consumed_at field in the database.
  54. FieldConsumedAt = "consumed_at"
  55. // EdgeTargetUser holds the string denoting the target_user edge name in mutations.
  56. EdgeTargetUser = "target_user"
  57. // EdgeAdoptionDecision holds the string denoting the adoption_decision edge name in mutations.
  58. EdgeAdoptionDecision = "adoption_decision"
  59. // Table holds the table name of the pendingauthsession in the database.
  60. Table = "pending_auth_sessions"
  61. // TargetUserTable is the table that holds the target_user relation/edge.
  62. TargetUserTable = "pending_auth_sessions"
  63. // TargetUserInverseTable is the table name for the User entity.
  64. // It exists in this package in order to avoid circular dependency with the "user" package.
  65. TargetUserInverseTable = "users"
  66. // TargetUserColumn is the table column denoting the target_user relation/edge.
  67. TargetUserColumn = "target_user_id"
  68. // AdoptionDecisionTable is the table that holds the adoption_decision relation/edge.
  69. AdoptionDecisionTable = "identity_adoption_decisions"
  70. // AdoptionDecisionInverseTable is the table name for the IdentityAdoptionDecision entity.
  71. // It exists in this package in order to avoid circular dependency with the "identityadoptiondecision" package.
  72. AdoptionDecisionInverseTable = "identity_adoption_decisions"
  73. // AdoptionDecisionColumn is the table column denoting the adoption_decision relation/edge.
  74. AdoptionDecisionColumn = "pending_auth_session_id"
  75. )
  76. // Columns holds all SQL columns for pendingauthsession fields.
  77. var Columns = []string{
  78. FieldID,
  79. FieldCreatedAt,
  80. FieldUpdatedAt,
  81. FieldSessionToken,
  82. FieldIntent,
  83. FieldProviderType,
  84. FieldProviderKey,
  85. FieldProviderSubject,
  86. FieldTargetUserID,
  87. FieldRedirectTo,
  88. FieldResolvedEmail,
  89. FieldRegistrationPasswordHash,
  90. FieldUpstreamIdentityClaims,
  91. FieldLocalFlowState,
  92. FieldBrowserSessionKey,
  93. FieldCompletionCodeHash,
  94. FieldCompletionCodeExpiresAt,
  95. FieldEmailVerifiedAt,
  96. FieldPasswordVerifiedAt,
  97. FieldTotpVerifiedAt,
  98. FieldExpiresAt,
  99. FieldConsumedAt,
  100. }
  101. // ValidColumn reports if the column name is valid (part of the table columns).
  102. func ValidColumn(column string) bool {
  103. for i := range Columns {
  104. if column == Columns[i] {
  105. return true
  106. }
  107. }
  108. return false
  109. }
  110. var (
  111. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  112. DefaultCreatedAt func() time.Time
  113. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  114. DefaultUpdatedAt func() time.Time
  115. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  116. UpdateDefaultUpdatedAt func() time.Time
  117. // SessionTokenValidator is a validator for the "session_token" field. It is called by the builders before save.
  118. SessionTokenValidator func(string) error
  119. // IntentValidator is a validator for the "intent" field. It is called by the builders before save.
  120. IntentValidator func(string) error
  121. // ProviderTypeValidator is a validator for the "provider_type" field. It is called by the builders before save.
  122. ProviderTypeValidator func(string) error
  123. // ProviderKeyValidator is a validator for the "provider_key" field. It is called by the builders before save.
  124. ProviderKeyValidator func(string) error
  125. // ProviderSubjectValidator is a validator for the "provider_subject" field. It is called by the builders before save.
  126. ProviderSubjectValidator func(string) error
  127. // DefaultRedirectTo holds the default value on creation for the "redirect_to" field.
  128. DefaultRedirectTo string
  129. // DefaultResolvedEmail holds the default value on creation for the "resolved_email" field.
  130. DefaultResolvedEmail string
  131. // DefaultRegistrationPasswordHash holds the default value on creation for the "registration_password_hash" field.
  132. DefaultRegistrationPasswordHash string
  133. // DefaultUpstreamIdentityClaims holds the default value on creation for the "upstream_identity_claims" field.
  134. DefaultUpstreamIdentityClaims func() map[string]interface{}
  135. // DefaultLocalFlowState holds the default value on creation for the "local_flow_state" field.
  136. DefaultLocalFlowState func() map[string]interface{}
  137. // DefaultBrowserSessionKey holds the default value on creation for the "browser_session_key" field.
  138. DefaultBrowserSessionKey string
  139. // DefaultCompletionCodeHash holds the default value on creation for the "completion_code_hash" field.
  140. DefaultCompletionCodeHash string
  141. )
  142. // OrderOption defines the ordering options for the PendingAuthSession queries.
  143. type OrderOption func(*sql.Selector)
  144. // ByID orders the results by the id field.
  145. func ByID(opts ...sql.OrderTermOption) OrderOption {
  146. return sql.OrderByField(FieldID, opts...).ToFunc()
  147. }
  148. // ByCreatedAt orders the results by the created_at field.
  149. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  150. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  151. }
  152. // ByUpdatedAt orders the results by the updated_at field.
  153. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  154. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  155. }
  156. // BySessionToken orders the results by the session_token field.
  157. func BySessionToken(opts ...sql.OrderTermOption) OrderOption {
  158. return sql.OrderByField(FieldSessionToken, opts...).ToFunc()
  159. }
  160. // ByIntent orders the results by the intent field.
  161. func ByIntent(opts ...sql.OrderTermOption) OrderOption {
  162. return sql.OrderByField(FieldIntent, opts...).ToFunc()
  163. }
  164. // ByProviderType orders the results by the provider_type field.
  165. func ByProviderType(opts ...sql.OrderTermOption) OrderOption {
  166. return sql.OrderByField(FieldProviderType, opts...).ToFunc()
  167. }
  168. // ByProviderKey orders the results by the provider_key field.
  169. func ByProviderKey(opts ...sql.OrderTermOption) OrderOption {
  170. return sql.OrderByField(FieldProviderKey, opts...).ToFunc()
  171. }
  172. // ByProviderSubject orders the results by the provider_subject field.
  173. func ByProviderSubject(opts ...sql.OrderTermOption) OrderOption {
  174. return sql.OrderByField(FieldProviderSubject, opts...).ToFunc()
  175. }
  176. // ByTargetUserID orders the results by the target_user_id field.
  177. func ByTargetUserID(opts ...sql.OrderTermOption) OrderOption {
  178. return sql.OrderByField(FieldTargetUserID, opts...).ToFunc()
  179. }
  180. // ByRedirectTo orders the results by the redirect_to field.
  181. func ByRedirectTo(opts ...sql.OrderTermOption) OrderOption {
  182. return sql.OrderByField(FieldRedirectTo, opts...).ToFunc()
  183. }
  184. // ByResolvedEmail orders the results by the resolved_email field.
  185. func ByResolvedEmail(opts ...sql.OrderTermOption) OrderOption {
  186. return sql.OrderByField(FieldResolvedEmail, opts...).ToFunc()
  187. }
  188. // ByRegistrationPasswordHash orders the results by the registration_password_hash field.
  189. func ByRegistrationPasswordHash(opts ...sql.OrderTermOption) OrderOption {
  190. return sql.OrderByField(FieldRegistrationPasswordHash, opts...).ToFunc()
  191. }
  192. // ByBrowserSessionKey orders the results by the browser_session_key field.
  193. func ByBrowserSessionKey(opts ...sql.OrderTermOption) OrderOption {
  194. return sql.OrderByField(FieldBrowserSessionKey, opts...).ToFunc()
  195. }
  196. // ByCompletionCodeHash orders the results by the completion_code_hash field.
  197. func ByCompletionCodeHash(opts ...sql.OrderTermOption) OrderOption {
  198. return sql.OrderByField(FieldCompletionCodeHash, opts...).ToFunc()
  199. }
  200. // ByCompletionCodeExpiresAt orders the results by the completion_code_expires_at field.
  201. func ByCompletionCodeExpiresAt(opts ...sql.OrderTermOption) OrderOption {
  202. return sql.OrderByField(FieldCompletionCodeExpiresAt, opts...).ToFunc()
  203. }
  204. // ByEmailVerifiedAt orders the results by the email_verified_at field.
  205. func ByEmailVerifiedAt(opts ...sql.OrderTermOption) OrderOption {
  206. return sql.OrderByField(FieldEmailVerifiedAt, opts...).ToFunc()
  207. }
  208. // ByPasswordVerifiedAt orders the results by the password_verified_at field.
  209. func ByPasswordVerifiedAt(opts ...sql.OrderTermOption) OrderOption {
  210. return sql.OrderByField(FieldPasswordVerifiedAt, opts...).ToFunc()
  211. }
  212. // ByTotpVerifiedAt orders the results by the totp_verified_at field.
  213. func ByTotpVerifiedAt(opts ...sql.OrderTermOption) OrderOption {
  214. return sql.OrderByField(FieldTotpVerifiedAt, opts...).ToFunc()
  215. }
  216. // ByExpiresAt orders the results by the expires_at field.
  217. func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
  218. return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
  219. }
  220. // ByConsumedAt orders the results by the consumed_at field.
  221. func ByConsumedAt(opts ...sql.OrderTermOption) OrderOption {
  222. return sql.OrderByField(FieldConsumedAt, opts...).ToFunc()
  223. }
  224. // ByTargetUserField orders the results by target_user field.
  225. func ByTargetUserField(field string, opts ...sql.OrderTermOption) OrderOption {
  226. return func(s *sql.Selector) {
  227. sqlgraph.OrderByNeighborTerms(s, newTargetUserStep(), sql.OrderByField(field, opts...))
  228. }
  229. }
  230. // ByAdoptionDecisionField orders the results by adoption_decision field.
  231. func ByAdoptionDecisionField(field string, opts ...sql.OrderTermOption) OrderOption {
  232. return func(s *sql.Selector) {
  233. sqlgraph.OrderByNeighborTerms(s, newAdoptionDecisionStep(), sql.OrderByField(field, opts...))
  234. }
  235. }
  236. func newTargetUserStep() *sqlgraph.Step {
  237. return sqlgraph.NewStep(
  238. sqlgraph.From(Table, FieldID),
  239. sqlgraph.To(TargetUserInverseTable, FieldID),
  240. sqlgraph.Edge(sqlgraph.M2O, true, TargetUserTable, TargetUserColumn),
  241. )
  242. }
  243. func newAdoptionDecisionStep() *sqlgraph.Step {
  244. return sqlgraph.NewStep(
  245. sqlgraph.From(Table, FieldID),
  246. sqlgraph.To(AdoptionDecisionInverseTable, FieldID),
  247. sqlgraph.Edge(sqlgraph.O2O, false, AdoptionDecisionTable, AdoptionDecisionColumn),
  248. )
  249. }