user.go 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. // Code generated by ent, DO NOT EDIT.
  2. package user
  3. import (
  4. "time"
  5. "entgo.io/ent"
  6. "entgo.io/ent/dialect/sql"
  7. "entgo.io/ent/dialect/sql/sqlgraph"
  8. )
  9. const (
  10. // Label holds the string label denoting the user type in the database.
  11. Label = "user"
  12. // FieldID holds the string denoting the id field in the database.
  13. FieldID = "id"
  14. // FieldCreatedAt holds the string denoting the created_at field in the database.
  15. FieldCreatedAt = "created_at"
  16. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  17. FieldUpdatedAt = "updated_at"
  18. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  19. FieldDeletedAt = "deleted_at"
  20. // FieldEmail holds the string denoting the email field in the database.
  21. FieldEmail = "email"
  22. // FieldPasswordHash holds the string denoting the password_hash field in the database.
  23. FieldPasswordHash = "password_hash"
  24. // FieldRole holds the string denoting the role field in the database.
  25. FieldRole = "role"
  26. // FieldBalance holds the string denoting the balance field in the database.
  27. FieldBalance = "balance"
  28. // FieldFrozenBalance holds the string denoting the frozen_balance field in the database.
  29. FieldFrozenBalance = "frozen_balance"
  30. // FieldConcurrency holds the string denoting the concurrency field in the database.
  31. FieldConcurrency = "concurrency"
  32. // FieldStatus holds the string denoting the status field in the database.
  33. FieldStatus = "status"
  34. // FieldUsername holds the string denoting the username field in the database.
  35. FieldUsername = "username"
  36. // FieldNotes holds the string denoting the notes field in the database.
  37. FieldNotes = "notes"
  38. // FieldTotpSecretEncrypted holds the string denoting the totp_secret_encrypted field in the database.
  39. FieldTotpSecretEncrypted = "totp_secret_encrypted"
  40. // FieldTotpEnabled holds the string denoting the totp_enabled field in the database.
  41. FieldTotpEnabled = "totp_enabled"
  42. // FieldTotpEnabledAt holds the string denoting the totp_enabled_at field in the database.
  43. FieldTotpEnabledAt = "totp_enabled_at"
  44. // FieldSignupSource holds the string denoting the signup_source field in the database.
  45. FieldSignupSource = "signup_source"
  46. // FieldLastLoginAt holds the string denoting the last_login_at field in the database.
  47. FieldLastLoginAt = "last_login_at"
  48. // FieldLastActiveAt holds the string denoting the last_active_at field in the database.
  49. FieldLastActiveAt = "last_active_at"
  50. // FieldRestrictPublicGroups holds the string denoting the restrict_public_groups field in the database.
  51. FieldRestrictPublicGroups = "restrict_public_groups"
  52. // FieldBalanceNotifyEnabled holds the string denoting the balance_notify_enabled field in the database.
  53. FieldBalanceNotifyEnabled = "balance_notify_enabled"
  54. // FieldBalanceNotifyThresholdType holds the string denoting the balance_notify_threshold_type field in the database.
  55. FieldBalanceNotifyThresholdType = "balance_notify_threshold_type"
  56. // FieldBalanceNotifyThreshold holds the string denoting the balance_notify_threshold field in the database.
  57. FieldBalanceNotifyThreshold = "balance_notify_threshold"
  58. // FieldBalanceNotifyExtraEmails holds the string denoting the balance_notify_extra_emails field in the database.
  59. FieldBalanceNotifyExtraEmails = "balance_notify_extra_emails"
  60. // FieldTotalRecharged holds the string denoting the total_recharged field in the database.
  61. FieldTotalRecharged = "total_recharged"
  62. // FieldRpmLimit holds the string denoting the rpm_limit field in the database.
  63. FieldRpmLimit = "rpm_limit"
  64. // EdgeAPIKeys holds the string denoting the api_keys edge name in mutations.
  65. EdgeAPIKeys = "api_keys"
  66. // EdgeRedeemCodes holds the string denoting the redeem_codes edge name in mutations.
  67. EdgeRedeemCodes = "redeem_codes"
  68. // EdgeSubscriptions holds the string denoting the subscriptions edge name in mutations.
  69. EdgeSubscriptions = "subscriptions"
  70. // EdgeAssignedSubscriptions holds the string denoting the assigned_subscriptions edge name in mutations.
  71. EdgeAssignedSubscriptions = "assigned_subscriptions"
  72. // EdgeAnnouncementReads holds the string denoting the announcement_reads edge name in mutations.
  73. EdgeAnnouncementReads = "announcement_reads"
  74. // EdgeAllowedGroups holds the string denoting the allowed_groups edge name in mutations.
  75. EdgeAllowedGroups = "allowed_groups"
  76. // EdgeUsageLogs holds the string denoting the usage_logs edge name in mutations.
  77. EdgeUsageLogs = "usage_logs"
  78. // EdgeAttributeValues holds the string denoting the attribute_values edge name in mutations.
  79. EdgeAttributeValues = "attribute_values"
  80. // EdgePromoCodeUsages holds the string denoting the promo_code_usages edge name in mutations.
  81. EdgePromoCodeUsages = "promo_code_usages"
  82. // EdgePaymentOrders holds the string denoting the payment_orders edge name in mutations.
  83. EdgePaymentOrders = "payment_orders"
  84. // EdgeAuthIdentities holds the string denoting the auth_identities edge name in mutations.
  85. EdgeAuthIdentities = "auth_identities"
  86. // EdgePendingAuthSessions holds the string denoting the pending_auth_sessions edge name in mutations.
  87. EdgePendingAuthSessions = "pending_auth_sessions"
  88. // EdgePlatformQuotas holds the string denoting the platform_quotas edge name in mutations.
  89. EdgePlatformQuotas = "platform_quotas"
  90. // EdgeUserAllowedGroups holds the string denoting the user_allowed_groups edge name in mutations.
  91. EdgeUserAllowedGroups = "user_allowed_groups"
  92. // Table holds the table name of the user in the database.
  93. Table = "users"
  94. // APIKeysTable is the table that holds the api_keys relation/edge.
  95. APIKeysTable = "api_keys"
  96. // APIKeysInverseTable is the table name for the APIKey entity.
  97. // It exists in this package in order to avoid circular dependency with the "apikey" package.
  98. APIKeysInverseTable = "api_keys"
  99. // APIKeysColumn is the table column denoting the api_keys relation/edge.
  100. APIKeysColumn = "user_id"
  101. // RedeemCodesTable is the table that holds the redeem_codes relation/edge.
  102. RedeemCodesTable = "redeem_codes"
  103. // RedeemCodesInverseTable is the table name for the RedeemCode entity.
  104. // It exists in this package in order to avoid circular dependency with the "redeemcode" package.
  105. RedeemCodesInverseTable = "redeem_codes"
  106. // RedeemCodesColumn is the table column denoting the redeem_codes relation/edge.
  107. RedeemCodesColumn = "used_by"
  108. // SubscriptionsTable is the table that holds the subscriptions relation/edge.
  109. SubscriptionsTable = "user_subscriptions"
  110. // SubscriptionsInverseTable is the table name for the UserSubscription entity.
  111. // It exists in this package in order to avoid circular dependency with the "usersubscription" package.
  112. SubscriptionsInverseTable = "user_subscriptions"
  113. // SubscriptionsColumn is the table column denoting the subscriptions relation/edge.
  114. SubscriptionsColumn = "user_id"
  115. // AssignedSubscriptionsTable is the table that holds the assigned_subscriptions relation/edge.
  116. AssignedSubscriptionsTable = "user_subscriptions"
  117. // AssignedSubscriptionsInverseTable is the table name for the UserSubscription entity.
  118. // It exists in this package in order to avoid circular dependency with the "usersubscription" package.
  119. AssignedSubscriptionsInverseTable = "user_subscriptions"
  120. // AssignedSubscriptionsColumn is the table column denoting the assigned_subscriptions relation/edge.
  121. AssignedSubscriptionsColumn = "assigned_by"
  122. // AnnouncementReadsTable is the table that holds the announcement_reads relation/edge.
  123. AnnouncementReadsTable = "announcement_reads"
  124. // AnnouncementReadsInverseTable is the table name for the AnnouncementRead entity.
  125. // It exists in this package in order to avoid circular dependency with the "announcementread" package.
  126. AnnouncementReadsInverseTable = "announcement_reads"
  127. // AnnouncementReadsColumn is the table column denoting the announcement_reads relation/edge.
  128. AnnouncementReadsColumn = "user_id"
  129. // AllowedGroupsTable is the table that holds the allowed_groups relation/edge. The primary key declared below.
  130. AllowedGroupsTable = "user_allowed_groups"
  131. // AllowedGroupsInverseTable is the table name for the Group entity.
  132. // It exists in this package in order to avoid circular dependency with the "group" package.
  133. AllowedGroupsInverseTable = "groups"
  134. // UsageLogsTable is the table that holds the usage_logs relation/edge.
  135. UsageLogsTable = "usage_logs"
  136. // UsageLogsInverseTable is the table name for the UsageLog entity.
  137. // It exists in this package in order to avoid circular dependency with the "usagelog" package.
  138. UsageLogsInverseTable = "usage_logs"
  139. // UsageLogsColumn is the table column denoting the usage_logs relation/edge.
  140. UsageLogsColumn = "user_id"
  141. // AttributeValuesTable is the table that holds the attribute_values relation/edge.
  142. AttributeValuesTable = "user_attribute_values"
  143. // AttributeValuesInverseTable is the table name for the UserAttributeValue entity.
  144. // It exists in this package in order to avoid circular dependency with the "userattributevalue" package.
  145. AttributeValuesInverseTable = "user_attribute_values"
  146. // AttributeValuesColumn is the table column denoting the attribute_values relation/edge.
  147. AttributeValuesColumn = "user_id"
  148. // PromoCodeUsagesTable is the table that holds the promo_code_usages relation/edge.
  149. PromoCodeUsagesTable = "promo_code_usages"
  150. // PromoCodeUsagesInverseTable is the table name for the PromoCodeUsage entity.
  151. // It exists in this package in order to avoid circular dependency with the "promocodeusage" package.
  152. PromoCodeUsagesInverseTable = "promo_code_usages"
  153. // PromoCodeUsagesColumn is the table column denoting the promo_code_usages relation/edge.
  154. PromoCodeUsagesColumn = "user_id"
  155. // PaymentOrdersTable is the table that holds the payment_orders relation/edge.
  156. PaymentOrdersTable = "payment_orders"
  157. // PaymentOrdersInverseTable is the table name for the PaymentOrder entity.
  158. // It exists in this package in order to avoid circular dependency with the "paymentorder" package.
  159. PaymentOrdersInverseTable = "payment_orders"
  160. // PaymentOrdersColumn is the table column denoting the payment_orders relation/edge.
  161. PaymentOrdersColumn = "user_id"
  162. // AuthIdentitiesTable is the table that holds the auth_identities relation/edge.
  163. AuthIdentitiesTable = "auth_identities"
  164. // AuthIdentitiesInverseTable is the table name for the AuthIdentity entity.
  165. // It exists in this package in order to avoid circular dependency with the "authidentity" package.
  166. AuthIdentitiesInverseTable = "auth_identities"
  167. // AuthIdentitiesColumn is the table column denoting the auth_identities relation/edge.
  168. AuthIdentitiesColumn = "user_id"
  169. // PendingAuthSessionsTable is the table that holds the pending_auth_sessions relation/edge.
  170. PendingAuthSessionsTable = "pending_auth_sessions"
  171. // PendingAuthSessionsInverseTable is the table name for the PendingAuthSession entity.
  172. // It exists in this package in order to avoid circular dependency with the "pendingauthsession" package.
  173. PendingAuthSessionsInverseTable = "pending_auth_sessions"
  174. // PendingAuthSessionsColumn is the table column denoting the pending_auth_sessions relation/edge.
  175. PendingAuthSessionsColumn = "target_user_id"
  176. // PlatformQuotasTable is the table that holds the platform_quotas relation/edge.
  177. PlatformQuotasTable = "user_platform_quotas"
  178. // PlatformQuotasInverseTable is the table name for the UserPlatformQuota entity.
  179. // It exists in this package in order to avoid circular dependency with the "userplatformquota" package.
  180. PlatformQuotasInverseTable = "user_platform_quotas"
  181. // PlatformQuotasColumn is the table column denoting the platform_quotas relation/edge.
  182. PlatformQuotasColumn = "user_id"
  183. // UserAllowedGroupsTable is the table that holds the user_allowed_groups relation/edge.
  184. UserAllowedGroupsTable = "user_allowed_groups"
  185. // UserAllowedGroupsInverseTable is the table name for the UserAllowedGroup entity.
  186. // It exists in this package in order to avoid circular dependency with the "userallowedgroup" package.
  187. UserAllowedGroupsInverseTable = "user_allowed_groups"
  188. // UserAllowedGroupsColumn is the table column denoting the user_allowed_groups relation/edge.
  189. UserAllowedGroupsColumn = "user_id"
  190. )
  191. // Columns holds all SQL columns for user fields.
  192. var Columns = []string{
  193. FieldID,
  194. FieldCreatedAt,
  195. FieldUpdatedAt,
  196. FieldDeletedAt,
  197. FieldEmail,
  198. FieldPasswordHash,
  199. FieldRole,
  200. FieldBalance,
  201. FieldFrozenBalance,
  202. FieldConcurrency,
  203. FieldStatus,
  204. FieldUsername,
  205. FieldNotes,
  206. FieldTotpSecretEncrypted,
  207. FieldTotpEnabled,
  208. FieldTotpEnabledAt,
  209. FieldSignupSource,
  210. FieldLastLoginAt,
  211. FieldLastActiveAt,
  212. FieldRestrictPublicGroups,
  213. FieldBalanceNotifyEnabled,
  214. FieldBalanceNotifyThresholdType,
  215. FieldBalanceNotifyThreshold,
  216. FieldBalanceNotifyExtraEmails,
  217. FieldTotalRecharged,
  218. FieldRpmLimit,
  219. }
  220. var (
  221. // AllowedGroupsPrimaryKey and AllowedGroupsColumn2 are the table columns denoting the
  222. // primary key for the allowed_groups relation (M2M).
  223. AllowedGroupsPrimaryKey = []string{"user_id", "group_id"}
  224. )
  225. // ValidColumn reports if the column name is valid (part of the table columns).
  226. func ValidColumn(column string) bool {
  227. for i := range Columns {
  228. if column == Columns[i] {
  229. return true
  230. }
  231. }
  232. return false
  233. }
  234. // Note that the variables below are initialized by the runtime
  235. // package on the initialization of the application. Therefore,
  236. // it should be imported in the main as follows:
  237. //
  238. // import _ "github.com/Wei-Shaw/sub2api/ent/runtime"
  239. var (
  240. Hooks [1]ent.Hook
  241. Interceptors [1]ent.Interceptor
  242. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  243. DefaultCreatedAt func() time.Time
  244. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  245. DefaultUpdatedAt func() time.Time
  246. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  247. UpdateDefaultUpdatedAt func() time.Time
  248. // EmailValidator is a validator for the "email" field. It is called by the builders before save.
  249. EmailValidator func(string) error
  250. // PasswordHashValidator is a validator for the "password_hash" field. It is called by the builders before save.
  251. PasswordHashValidator func(string) error
  252. // DefaultRole holds the default value on creation for the "role" field.
  253. DefaultRole string
  254. // RoleValidator is a validator for the "role" field. It is called by the builders before save.
  255. RoleValidator func(string) error
  256. // DefaultBalance holds the default value on creation for the "balance" field.
  257. DefaultBalance float64
  258. // DefaultFrozenBalance holds the default value on creation for the "frozen_balance" field.
  259. DefaultFrozenBalance float64
  260. // DefaultConcurrency holds the default value on creation for the "concurrency" field.
  261. DefaultConcurrency int
  262. // DefaultStatus holds the default value on creation for the "status" field.
  263. DefaultStatus string
  264. // StatusValidator is a validator for the "status" field. It is called by the builders before save.
  265. StatusValidator func(string) error
  266. // DefaultUsername holds the default value on creation for the "username" field.
  267. DefaultUsername string
  268. // UsernameValidator is a validator for the "username" field. It is called by the builders before save.
  269. UsernameValidator func(string) error
  270. // DefaultNotes holds the default value on creation for the "notes" field.
  271. DefaultNotes string
  272. // DefaultTotpEnabled holds the default value on creation for the "totp_enabled" field.
  273. DefaultTotpEnabled bool
  274. // DefaultSignupSource holds the default value on creation for the "signup_source" field.
  275. DefaultSignupSource string
  276. // SignupSourceValidator is a validator for the "signup_source" field. It is called by the builders before save.
  277. SignupSourceValidator func(string) error
  278. // DefaultRestrictPublicGroups holds the default value on creation for the "restrict_public_groups" field.
  279. DefaultRestrictPublicGroups bool
  280. // DefaultBalanceNotifyEnabled holds the default value on creation for the "balance_notify_enabled" field.
  281. DefaultBalanceNotifyEnabled bool
  282. // DefaultBalanceNotifyThresholdType holds the default value on creation for the "balance_notify_threshold_type" field.
  283. DefaultBalanceNotifyThresholdType string
  284. // DefaultBalanceNotifyExtraEmails holds the default value on creation for the "balance_notify_extra_emails" field.
  285. DefaultBalanceNotifyExtraEmails string
  286. // DefaultTotalRecharged holds the default value on creation for the "total_recharged" field.
  287. DefaultTotalRecharged float64
  288. // DefaultRpmLimit holds the default value on creation for the "rpm_limit" field.
  289. DefaultRpmLimit int
  290. )
  291. // OrderOption defines the ordering options for the User queries.
  292. type OrderOption func(*sql.Selector)
  293. // ByID orders the results by the id field.
  294. func ByID(opts ...sql.OrderTermOption) OrderOption {
  295. return sql.OrderByField(FieldID, opts...).ToFunc()
  296. }
  297. // ByCreatedAt orders the results by the created_at field.
  298. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  299. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  300. }
  301. // ByUpdatedAt orders the results by the updated_at field.
  302. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  303. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  304. }
  305. // ByDeletedAt orders the results by the deleted_at field.
  306. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  307. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  308. }
  309. // ByEmail orders the results by the email field.
  310. func ByEmail(opts ...sql.OrderTermOption) OrderOption {
  311. return sql.OrderByField(FieldEmail, opts...).ToFunc()
  312. }
  313. // ByPasswordHash orders the results by the password_hash field.
  314. func ByPasswordHash(opts ...sql.OrderTermOption) OrderOption {
  315. return sql.OrderByField(FieldPasswordHash, opts...).ToFunc()
  316. }
  317. // ByRole orders the results by the role field.
  318. func ByRole(opts ...sql.OrderTermOption) OrderOption {
  319. return sql.OrderByField(FieldRole, opts...).ToFunc()
  320. }
  321. // ByBalance orders the results by the balance field.
  322. func ByBalance(opts ...sql.OrderTermOption) OrderOption {
  323. return sql.OrderByField(FieldBalance, opts...).ToFunc()
  324. }
  325. // ByFrozenBalance orders the results by the frozen_balance field.
  326. func ByFrozenBalance(opts ...sql.OrderTermOption) OrderOption {
  327. return sql.OrderByField(FieldFrozenBalance, opts...).ToFunc()
  328. }
  329. // ByConcurrency orders the results by the concurrency field.
  330. func ByConcurrency(opts ...sql.OrderTermOption) OrderOption {
  331. return sql.OrderByField(FieldConcurrency, opts...).ToFunc()
  332. }
  333. // ByStatus orders the results by the status field.
  334. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  335. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  336. }
  337. // ByUsername orders the results by the username field.
  338. func ByUsername(opts ...sql.OrderTermOption) OrderOption {
  339. return sql.OrderByField(FieldUsername, opts...).ToFunc()
  340. }
  341. // ByNotes orders the results by the notes field.
  342. func ByNotes(opts ...sql.OrderTermOption) OrderOption {
  343. return sql.OrderByField(FieldNotes, opts...).ToFunc()
  344. }
  345. // ByTotpSecretEncrypted orders the results by the totp_secret_encrypted field.
  346. func ByTotpSecretEncrypted(opts ...sql.OrderTermOption) OrderOption {
  347. return sql.OrderByField(FieldTotpSecretEncrypted, opts...).ToFunc()
  348. }
  349. // ByTotpEnabled orders the results by the totp_enabled field.
  350. func ByTotpEnabled(opts ...sql.OrderTermOption) OrderOption {
  351. return sql.OrderByField(FieldTotpEnabled, opts...).ToFunc()
  352. }
  353. // ByTotpEnabledAt orders the results by the totp_enabled_at field.
  354. func ByTotpEnabledAt(opts ...sql.OrderTermOption) OrderOption {
  355. return sql.OrderByField(FieldTotpEnabledAt, opts...).ToFunc()
  356. }
  357. // BySignupSource orders the results by the signup_source field.
  358. func BySignupSource(opts ...sql.OrderTermOption) OrderOption {
  359. return sql.OrderByField(FieldSignupSource, opts...).ToFunc()
  360. }
  361. // ByLastLoginAt orders the results by the last_login_at field.
  362. func ByLastLoginAt(opts ...sql.OrderTermOption) OrderOption {
  363. return sql.OrderByField(FieldLastLoginAt, opts...).ToFunc()
  364. }
  365. // ByLastActiveAt orders the results by the last_active_at field.
  366. func ByLastActiveAt(opts ...sql.OrderTermOption) OrderOption {
  367. return sql.OrderByField(FieldLastActiveAt, opts...).ToFunc()
  368. }
  369. // ByRestrictPublicGroups orders the results by the restrict_public_groups field.
  370. func ByRestrictPublicGroups(opts ...sql.OrderTermOption) OrderOption {
  371. return sql.OrderByField(FieldRestrictPublicGroups, opts...).ToFunc()
  372. }
  373. // ByBalanceNotifyEnabled orders the results by the balance_notify_enabled field.
  374. func ByBalanceNotifyEnabled(opts ...sql.OrderTermOption) OrderOption {
  375. return sql.OrderByField(FieldBalanceNotifyEnabled, opts...).ToFunc()
  376. }
  377. // ByBalanceNotifyThresholdType orders the results by the balance_notify_threshold_type field.
  378. func ByBalanceNotifyThresholdType(opts ...sql.OrderTermOption) OrderOption {
  379. return sql.OrderByField(FieldBalanceNotifyThresholdType, opts...).ToFunc()
  380. }
  381. // ByBalanceNotifyThreshold orders the results by the balance_notify_threshold field.
  382. func ByBalanceNotifyThreshold(opts ...sql.OrderTermOption) OrderOption {
  383. return sql.OrderByField(FieldBalanceNotifyThreshold, opts...).ToFunc()
  384. }
  385. // ByBalanceNotifyExtraEmails orders the results by the balance_notify_extra_emails field.
  386. func ByBalanceNotifyExtraEmails(opts ...sql.OrderTermOption) OrderOption {
  387. return sql.OrderByField(FieldBalanceNotifyExtraEmails, opts...).ToFunc()
  388. }
  389. // ByTotalRecharged orders the results by the total_recharged field.
  390. func ByTotalRecharged(opts ...sql.OrderTermOption) OrderOption {
  391. return sql.OrderByField(FieldTotalRecharged, opts...).ToFunc()
  392. }
  393. // ByRpmLimit orders the results by the rpm_limit field.
  394. func ByRpmLimit(opts ...sql.OrderTermOption) OrderOption {
  395. return sql.OrderByField(FieldRpmLimit, opts...).ToFunc()
  396. }
  397. // ByAPIKeysCount orders the results by api_keys count.
  398. func ByAPIKeysCount(opts ...sql.OrderTermOption) OrderOption {
  399. return func(s *sql.Selector) {
  400. sqlgraph.OrderByNeighborsCount(s, newAPIKeysStep(), opts...)
  401. }
  402. }
  403. // ByAPIKeys orders the results by api_keys terms.
  404. func ByAPIKeys(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  405. return func(s *sql.Selector) {
  406. sqlgraph.OrderByNeighborTerms(s, newAPIKeysStep(), append([]sql.OrderTerm{term}, terms...)...)
  407. }
  408. }
  409. // ByRedeemCodesCount orders the results by redeem_codes count.
  410. func ByRedeemCodesCount(opts ...sql.OrderTermOption) OrderOption {
  411. return func(s *sql.Selector) {
  412. sqlgraph.OrderByNeighborsCount(s, newRedeemCodesStep(), opts...)
  413. }
  414. }
  415. // ByRedeemCodes orders the results by redeem_codes terms.
  416. func ByRedeemCodes(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  417. return func(s *sql.Selector) {
  418. sqlgraph.OrderByNeighborTerms(s, newRedeemCodesStep(), append([]sql.OrderTerm{term}, terms...)...)
  419. }
  420. }
  421. // BySubscriptionsCount orders the results by subscriptions count.
  422. func BySubscriptionsCount(opts ...sql.OrderTermOption) OrderOption {
  423. return func(s *sql.Selector) {
  424. sqlgraph.OrderByNeighborsCount(s, newSubscriptionsStep(), opts...)
  425. }
  426. }
  427. // BySubscriptions orders the results by subscriptions terms.
  428. func BySubscriptions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  429. return func(s *sql.Selector) {
  430. sqlgraph.OrderByNeighborTerms(s, newSubscriptionsStep(), append([]sql.OrderTerm{term}, terms...)...)
  431. }
  432. }
  433. // ByAssignedSubscriptionsCount orders the results by assigned_subscriptions count.
  434. func ByAssignedSubscriptionsCount(opts ...sql.OrderTermOption) OrderOption {
  435. return func(s *sql.Selector) {
  436. sqlgraph.OrderByNeighborsCount(s, newAssignedSubscriptionsStep(), opts...)
  437. }
  438. }
  439. // ByAssignedSubscriptions orders the results by assigned_subscriptions terms.
  440. func ByAssignedSubscriptions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  441. return func(s *sql.Selector) {
  442. sqlgraph.OrderByNeighborTerms(s, newAssignedSubscriptionsStep(), append([]sql.OrderTerm{term}, terms...)...)
  443. }
  444. }
  445. // ByAnnouncementReadsCount orders the results by announcement_reads count.
  446. func ByAnnouncementReadsCount(opts ...sql.OrderTermOption) OrderOption {
  447. return func(s *sql.Selector) {
  448. sqlgraph.OrderByNeighborsCount(s, newAnnouncementReadsStep(), opts...)
  449. }
  450. }
  451. // ByAnnouncementReads orders the results by announcement_reads terms.
  452. func ByAnnouncementReads(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  453. return func(s *sql.Selector) {
  454. sqlgraph.OrderByNeighborTerms(s, newAnnouncementReadsStep(), append([]sql.OrderTerm{term}, terms...)...)
  455. }
  456. }
  457. // ByAllowedGroupsCount orders the results by allowed_groups count.
  458. func ByAllowedGroupsCount(opts ...sql.OrderTermOption) OrderOption {
  459. return func(s *sql.Selector) {
  460. sqlgraph.OrderByNeighborsCount(s, newAllowedGroupsStep(), opts...)
  461. }
  462. }
  463. // ByAllowedGroups orders the results by allowed_groups terms.
  464. func ByAllowedGroups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  465. return func(s *sql.Selector) {
  466. sqlgraph.OrderByNeighborTerms(s, newAllowedGroupsStep(), append([]sql.OrderTerm{term}, terms...)...)
  467. }
  468. }
  469. // ByUsageLogsCount orders the results by usage_logs count.
  470. func ByUsageLogsCount(opts ...sql.OrderTermOption) OrderOption {
  471. return func(s *sql.Selector) {
  472. sqlgraph.OrderByNeighborsCount(s, newUsageLogsStep(), opts...)
  473. }
  474. }
  475. // ByUsageLogs orders the results by usage_logs terms.
  476. func ByUsageLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  477. return func(s *sql.Selector) {
  478. sqlgraph.OrderByNeighborTerms(s, newUsageLogsStep(), append([]sql.OrderTerm{term}, terms...)...)
  479. }
  480. }
  481. // ByAttributeValuesCount orders the results by attribute_values count.
  482. func ByAttributeValuesCount(opts ...sql.OrderTermOption) OrderOption {
  483. return func(s *sql.Selector) {
  484. sqlgraph.OrderByNeighborsCount(s, newAttributeValuesStep(), opts...)
  485. }
  486. }
  487. // ByAttributeValues orders the results by attribute_values terms.
  488. func ByAttributeValues(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  489. return func(s *sql.Selector) {
  490. sqlgraph.OrderByNeighborTerms(s, newAttributeValuesStep(), append([]sql.OrderTerm{term}, terms...)...)
  491. }
  492. }
  493. // ByPromoCodeUsagesCount orders the results by promo_code_usages count.
  494. func ByPromoCodeUsagesCount(opts ...sql.OrderTermOption) OrderOption {
  495. return func(s *sql.Selector) {
  496. sqlgraph.OrderByNeighborsCount(s, newPromoCodeUsagesStep(), opts...)
  497. }
  498. }
  499. // ByPromoCodeUsages orders the results by promo_code_usages terms.
  500. func ByPromoCodeUsages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  501. return func(s *sql.Selector) {
  502. sqlgraph.OrderByNeighborTerms(s, newPromoCodeUsagesStep(), append([]sql.OrderTerm{term}, terms...)...)
  503. }
  504. }
  505. // ByPaymentOrdersCount orders the results by payment_orders count.
  506. func ByPaymentOrdersCount(opts ...sql.OrderTermOption) OrderOption {
  507. return func(s *sql.Selector) {
  508. sqlgraph.OrderByNeighborsCount(s, newPaymentOrdersStep(), opts...)
  509. }
  510. }
  511. // ByPaymentOrders orders the results by payment_orders terms.
  512. func ByPaymentOrders(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  513. return func(s *sql.Selector) {
  514. sqlgraph.OrderByNeighborTerms(s, newPaymentOrdersStep(), append([]sql.OrderTerm{term}, terms...)...)
  515. }
  516. }
  517. // ByAuthIdentitiesCount orders the results by auth_identities count.
  518. func ByAuthIdentitiesCount(opts ...sql.OrderTermOption) OrderOption {
  519. return func(s *sql.Selector) {
  520. sqlgraph.OrderByNeighborsCount(s, newAuthIdentitiesStep(), opts...)
  521. }
  522. }
  523. // ByAuthIdentities orders the results by auth_identities terms.
  524. func ByAuthIdentities(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  525. return func(s *sql.Selector) {
  526. sqlgraph.OrderByNeighborTerms(s, newAuthIdentitiesStep(), append([]sql.OrderTerm{term}, terms...)...)
  527. }
  528. }
  529. // ByPendingAuthSessionsCount orders the results by pending_auth_sessions count.
  530. func ByPendingAuthSessionsCount(opts ...sql.OrderTermOption) OrderOption {
  531. return func(s *sql.Selector) {
  532. sqlgraph.OrderByNeighborsCount(s, newPendingAuthSessionsStep(), opts...)
  533. }
  534. }
  535. // ByPendingAuthSessions orders the results by pending_auth_sessions terms.
  536. func ByPendingAuthSessions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  537. return func(s *sql.Selector) {
  538. sqlgraph.OrderByNeighborTerms(s, newPendingAuthSessionsStep(), append([]sql.OrderTerm{term}, terms...)...)
  539. }
  540. }
  541. // ByPlatformQuotasCount orders the results by platform_quotas count.
  542. func ByPlatformQuotasCount(opts ...sql.OrderTermOption) OrderOption {
  543. return func(s *sql.Selector) {
  544. sqlgraph.OrderByNeighborsCount(s, newPlatformQuotasStep(), opts...)
  545. }
  546. }
  547. // ByPlatformQuotas orders the results by platform_quotas terms.
  548. func ByPlatformQuotas(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  549. return func(s *sql.Selector) {
  550. sqlgraph.OrderByNeighborTerms(s, newPlatformQuotasStep(), append([]sql.OrderTerm{term}, terms...)...)
  551. }
  552. }
  553. // ByUserAllowedGroupsCount orders the results by user_allowed_groups count.
  554. func ByUserAllowedGroupsCount(opts ...sql.OrderTermOption) OrderOption {
  555. return func(s *sql.Selector) {
  556. sqlgraph.OrderByNeighborsCount(s, newUserAllowedGroupsStep(), opts...)
  557. }
  558. }
  559. // ByUserAllowedGroups orders the results by user_allowed_groups terms.
  560. func ByUserAllowedGroups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  561. return func(s *sql.Selector) {
  562. sqlgraph.OrderByNeighborTerms(s, newUserAllowedGroupsStep(), append([]sql.OrderTerm{term}, terms...)...)
  563. }
  564. }
  565. func newAPIKeysStep() *sqlgraph.Step {
  566. return sqlgraph.NewStep(
  567. sqlgraph.From(Table, FieldID),
  568. sqlgraph.To(APIKeysInverseTable, FieldID),
  569. sqlgraph.Edge(sqlgraph.O2M, false, APIKeysTable, APIKeysColumn),
  570. )
  571. }
  572. func newRedeemCodesStep() *sqlgraph.Step {
  573. return sqlgraph.NewStep(
  574. sqlgraph.From(Table, FieldID),
  575. sqlgraph.To(RedeemCodesInverseTable, FieldID),
  576. sqlgraph.Edge(sqlgraph.O2M, false, RedeemCodesTable, RedeemCodesColumn),
  577. )
  578. }
  579. func newSubscriptionsStep() *sqlgraph.Step {
  580. return sqlgraph.NewStep(
  581. sqlgraph.From(Table, FieldID),
  582. sqlgraph.To(SubscriptionsInverseTable, FieldID),
  583. sqlgraph.Edge(sqlgraph.O2M, false, SubscriptionsTable, SubscriptionsColumn),
  584. )
  585. }
  586. func newAssignedSubscriptionsStep() *sqlgraph.Step {
  587. return sqlgraph.NewStep(
  588. sqlgraph.From(Table, FieldID),
  589. sqlgraph.To(AssignedSubscriptionsInverseTable, FieldID),
  590. sqlgraph.Edge(sqlgraph.O2M, false, AssignedSubscriptionsTable, AssignedSubscriptionsColumn),
  591. )
  592. }
  593. func newAnnouncementReadsStep() *sqlgraph.Step {
  594. return sqlgraph.NewStep(
  595. sqlgraph.From(Table, FieldID),
  596. sqlgraph.To(AnnouncementReadsInverseTable, FieldID),
  597. sqlgraph.Edge(sqlgraph.O2M, false, AnnouncementReadsTable, AnnouncementReadsColumn),
  598. )
  599. }
  600. func newAllowedGroupsStep() *sqlgraph.Step {
  601. return sqlgraph.NewStep(
  602. sqlgraph.From(Table, FieldID),
  603. sqlgraph.To(AllowedGroupsInverseTable, FieldID),
  604. sqlgraph.Edge(sqlgraph.M2M, false, AllowedGroupsTable, AllowedGroupsPrimaryKey...),
  605. )
  606. }
  607. func newUsageLogsStep() *sqlgraph.Step {
  608. return sqlgraph.NewStep(
  609. sqlgraph.From(Table, FieldID),
  610. sqlgraph.To(UsageLogsInverseTable, FieldID),
  611. sqlgraph.Edge(sqlgraph.O2M, false, UsageLogsTable, UsageLogsColumn),
  612. )
  613. }
  614. func newAttributeValuesStep() *sqlgraph.Step {
  615. return sqlgraph.NewStep(
  616. sqlgraph.From(Table, FieldID),
  617. sqlgraph.To(AttributeValuesInverseTable, FieldID),
  618. sqlgraph.Edge(sqlgraph.O2M, false, AttributeValuesTable, AttributeValuesColumn),
  619. )
  620. }
  621. func newPromoCodeUsagesStep() *sqlgraph.Step {
  622. return sqlgraph.NewStep(
  623. sqlgraph.From(Table, FieldID),
  624. sqlgraph.To(PromoCodeUsagesInverseTable, FieldID),
  625. sqlgraph.Edge(sqlgraph.O2M, false, PromoCodeUsagesTable, PromoCodeUsagesColumn),
  626. )
  627. }
  628. func newPaymentOrdersStep() *sqlgraph.Step {
  629. return sqlgraph.NewStep(
  630. sqlgraph.From(Table, FieldID),
  631. sqlgraph.To(PaymentOrdersInverseTable, FieldID),
  632. sqlgraph.Edge(sqlgraph.O2M, false, PaymentOrdersTable, PaymentOrdersColumn),
  633. )
  634. }
  635. func newAuthIdentitiesStep() *sqlgraph.Step {
  636. return sqlgraph.NewStep(
  637. sqlgraph.From(Table, FieldID),
  638. sqlgraph.To(AuthIdentitiesInverseTable, FieldID),
  639. sqlgraph.Edge(sqlgraph.O2M, false, AuthIdentitiesTable, AuthIdentitiesColumn),
  640. )
  641. }
  642. func newPendingAuthSessionsStep() *sqlgraph.Step {
  643. return sqlgraph.NewStep(
  644. sqlgraph.From(Table, FieldID),
  645. sqlgraph.To(PendingAuthSessionsInverseTable, FieldID),
  646. sqlgraph.Edge(sqlgraph.O2M, false, PendingAuthSessionsTable, PendingAuthSessionsColumn),
  647. )
  648. }
  649. func newPlatformQuotasStep() *sqlgraph.Step {
  650. return sqlgraph.NewStep(
  651. sqlgraph.From(Table, FieldID),
  652. sqlgraph.To(PlatformQuotasInverseTable, FieldID),
  653. sqlgraph.Edge(sqlgraph.O2M, false, PlatformQuotasTable, PlatformQuotasColumn),
  654. )
  655. }
  656. func newUserAllowedGroupsStep() *sqlgraph.Step {
  657. return sqlgraph.NewStep(
  658. sqlgraph.From(Table, FieldID),
  659. sqlgraph.To(UserAllowedGroupsInverseTable, UserAllowedGroupsColumn),
  660. sqlgraph.Edge(sqlgraph.O2M, true, UserAllowedGroupsTable, UserAllowedGroupsColumn),
  661. )
  662. }