authidentity.go 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. // Code generated by ent, DO NOT EDIT.
  2. package authidentity
  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 authidentity type in the database.
  10. Label = "auth_identity"
  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. // FieldUserID holds the string denoting the user_id field in the database.
  18. FieldUserID = "user_id"
  19. // FieldProviderType holds the string denoting the provider_type field in the database.
  20. FieldProviderType = "provider_type"
  21. // FieldProviderKey holds the string denoting the provider_key field in the database.
  22. FieldProviderKey = "provider_key"
  23. // FieldProviderSubject holds the string denoting the provider_subject field in the database.
  24. FieldProviderSubject = "provider_subject"
  25. // FieldVerifiedAt holds the string denoting the verified_at field in the database.
  26. FieldVerifiedAt = "verified_at"
  27. // FieldIssuer holds the string denoting the issuer field in the database.
  28. FieldIssuer = "issuer"
  29. // FieldMetadata holds the string denoting the metadata field in the database.
  30. FieldMetadata = "metadata"
  31. // EdgeUser holds the string denoting the user edge name in mutations.
  32. EdgeUser = "user"
  33. // EdgeChannels holds the string denoting the channels edge name in mutations.
  34. EdgeChannels = "channels"
  35. // EdgeAdoptionDecisions holds the string denoting the adoption_decisions edge name in mutations.
  36. EdgeAdoptionDecisions = "adoption_decisions"
  37. // Table holds the table name of the authidentity in the database.
  38. Table = "auth_identities"
  39. // UserTable is the table that holds the user relation/edge.
  40. UserTable = "auth_identities"
  41. // UserInverseTable is the table name for the User entity.
  42. // It exists in this package in order to avoid circular dependency with the "user" package.
  43. UserInverseTable = "users"
  44. // UserColumn is the table column denoting the user relation/edge.
  45. UserColumn = "user_id"
  46. // ChannelsTable is the table that holds the channels relation/edge.
  47. ChannelsTable = "auth_identity_channels"
  48. // ChannelsInverseTable is the table name for the AuthIdentityChannel entity.
  49. // It exists in this package in order to avoid circular dependency with the "authidentitychannel" package.
  50. ChannelsInverseTable = "auth_identity_channels"
  51. // ChannelsColumn is the table column denoting the channels relation/edge.
  52. ChannelsColumn = "identity_id"
  53. // AdoptionDecisionsTable is the table that holds the adoption_decisions relation/edge.
  54. AdoptionDecisionsTable = "identity_adoption_decisions"
  55. // AdoptionDecisionsInverseTable is the table name for the IdentityAdoptionDecision entity.
  56. // It exists in this package in order to avoid circular dependency with the "identityadoptiondecision" package.
  57. AdoptionDecisionsInverseTable = "identity_adoption_decisions"
  58. // AdoptionDecisionsColumn is the table column denoting the adoption_decisions relation/edge.
  59. AdoptionDecisionsColumn = "identity_id"
  60. )
  61. // Columns holds all SQL columns for authidentity fields.
  62. var Columns = []string{
  63. FieldID,
  64. FieldCreatedAt,
  65. FieldUpdatedAt,
  66. FieldUserID,
  67. FieldProviderType,
  68. FieldProviderKey,
  69. FieldProviderSubject,
  70. FieldVerifiedAt,
  71. FieldIssuer,
  72. FieldMetadata,
  73. }
  74. // ValidColumn reports if the column name is valid (part of the table columns).
  75. func ValidColumn(column string) bool {
  76. for i := range Columns {
  77. if column == Columns[i] {
  78. return true
  79. }
  80. }
  81. return false
  82. }
  83. var (
  84. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  85. DefaultCreatedAt func() time.Time
  86. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  87. DefaultUpdatedAt func() time.Time
  88. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  89. UpdateDefaultUpdatedAt func() time.Time
  90. // ProviderTypeValidator is a validator for the "provider_type" field. It is called by the builders before save.
  91. ProviderTypeValidator func(string) error
  92. // ProviderKeyValidator is a validator for the "provider_key" field. It is called by the builders before save.
  93. ProviderKeyValidator func(string) error
  94. // ProviderSubjectValidator is a validator for the "provider_subject" field. It is called by the builders before save.
  95. ProviderSubjectValidator func(string) error
  96. // DefaultMetadata holds the default value on creation for the "metadata" field.
  97. DefaultMetadata func() map[string]interface{}
  98. )
  99. // OrderOption defines the ordering options for the AuthIdentity queries.
  100. type OrderOption func(*sql.Selector)
  101. // ByID orders the results by the id field.
  102. func ByID(opts ...sql.OrderTermOption) OrderOption {
  103. return sql.OrderByField(FieldID, opts...).ToFunc()
  104. }
  105. // ByCreatedAt orders the results by the created_at field.
  106. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  107. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  108. }
  109. // ByUpdatedAt orders the results by the updated_at field.
  110. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  111. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  112. }
  113. // ByUserID orders the results by the user_id field.
  114. func ByUserID(opts ...sql.OrderTermOption) OrderOption {
  115. return sql.OrderByField(FieldUserID, opts...).ToFunc()
  116. }
  117. // ByProviderType orders the results by the provider_type field.
  118. func ByProviderType(opts ...sql.OrderTermOption) OrderOption {
  119. return sql.OrderByField(FieldProviderType, opts...).ToFunc()
  120. }
  121. // ByProviderKey orders the results by the provider_key field.
  122. func ByProviderKey(opts ...sql.OrderTermOption) OrderOption {
  123. return sql.OrderByField(FieldProviderKey, opts...).ToFunc()
  124. }
  125. // ByProviderSubject orders the results by the provider_subject field.
  126. func ByProviderSubject(opts ...sql.OrderTermOption) OrderOption {
  127. return sql.OrderByField(FieldProviderSubject, opts...).ToFunc()
  128. }
  129. // ByVerifiedAt orders the results by the verified_at field.
  130. func ByVerifiedAt(opts ...sql.OrderTermOption) OrderOption {
  131. return sql.OrderByField(FieldVerifiedAt, opts...).ToFunc()
  132. }
  133. // ByIssuer orders the results by the issuer field.
  134. func ByIssuer(opts ...sql.OrderTermOption) OrderOption {
  135. return sql.OrderByField(FieldIssuer, opts...).ToFunc()
  136. }
  137. // ByUserField orders the results by user field.
  138. func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
  139. return func(s *sql.Selector) {
  140. sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
  141. }
  142. }
  143. // ByChannelsCount orders the results by channels count.
  144. func ByChannelsCount(opts ...sql.OrderTermOption) OrderOption {
  145. return func(s *sql.Selector) {
  146. sqlgraph.OrderByNeighborsCount(s, newChannelsStep(), opts...)
  147. }
  148. }
  149. // ByChannels orders the results by channels terms.
  150. func ByChannels(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  151. return func(s *sql.Selector) {
  152. sqlgraph.OrderByNeighborTerms(s, newChannelsStep(), append([]sql.OrderTerm{term}, terms...)...)
  153. }
  154. }
  155. // ByAdoptionDecisionsCount orders the results by adoption_decisions count.
  156. func ByAdoptionDecisionsCount(opts ...sql.OrderTermOption) OrderOption {
  157. return func(s *sql.Selector) {
  158. sqlgraph.OrderByNeighborsCount(s, newAdoptionDecisionsStep(), opts...)
  159. }
  160. }
  161. // ByAdoptionDecisions orders the results by adoption_decisions terms.
  162. func ByAdoptionDecisions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  163. return func(s *sql.Selector) {
  164. sqlgraph.OrderByNeighborTerms(s, newAdoptionDecisionsStep(), append([]sql.OrderTerm{term}, terms...)...)
  165. }
  166. }
  167. func newUserStep() *sqlgraph.Step {
  168. return sqlgraph.NewStep(
  169. sqlgraph.From(Table, FieldID),
  170. sqlgraph.To(UserInverseTable, FieldID),
  171. sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
  172. )
  173. }
  174. func newChannelsStep() *sqlgraph.Step {
  175. return sqlgraph.NewStep(
  176. sqlgraph.From(Table, FieldID),
  177. sqlgraph.To(ChannelsInverseTable, FieldID),
  178. sqlgraph.Edge(sqlgraph.O2M, false, ChannelsTable, ChannelsColumn),
  179. )
  180. }
  181. func newAdoptionDecisionsStep() *sqlgraph.Step {
  182. return sqlgraph.NewStep(
  183. sqlgraph.From(Table, FieldID),
  184. sqlgraph.To(AdoptionDecisionsInverseTable, FieldID),
  185. sqlgraph.Edge(sqlgraph.O2M, false, AdoptionDecisionsTable, AdoptionDecisionsColumn),
  186. )
  187. }