| |
|
|
| package user |
|
|
| import ( |
| "time" |
|
|
| "entgo.io/ent" |
| "entgo.io/ent/dialect/sql" |
| "entgo.io/ent/dialect/sql/sqlgraph" |
| ) |
|
|
| const ( |
| |
| Label = "user" |
| |
| FieldID = "id" |
| |
| FieldCreatedAt = "created_at" |
| |
| FieldUpdatedAt = "updated_at" |
| |
| FieldDeletedAt = "deleted_at" |
| |
| FieldEmail = "email" |
| |
| FieldPasswordHash = "password_hash" |
| |
| FieldRole = "role" |
| |
| FieldBalance = "balance" |
| |
| FieldConcurrency = "concurrency" |
| |
| FieldStatus = "status" |
| |
| FieldUsername = "username" |
| |
| FieldNotes = "notes" |
| |
| FieldTotpSecretEncrypted = "totp_secret_encrypted" |
| |
| FieldTotpEnabled = "totp_enabled" |
| |
| FieldTotpEnabledAt = "totp_enabled_at" |
| |
| FieldSoraStorageQuotaBytes = "sora_storage_quota_bytes" |
| |
| FieldSoraStorageUsedBytes = "sora_storage_used_bytes" |
| |
| EdgeAPIKeys = "api_keys" |
| |
| EdgeRedeemCodes = "redeem_codes" |
| |
| EdgeSubscriptions = "subscriptions" |
| |
| EdgeAssignedSubscriptions = "assigned_subscriptions" |
| |
| EdgeAnnouncementReads = "announcement_reads" |
| |
| EdgeAllowedGroups = "allowed_groups" |
| |
| EdgeUsageLogs = "usage_logs" |
| |
| EdgeAttributeValues = "attribute_values" |
| |
| EdgePromoCodeUsages = "promo_code_usages" |
| |
| EdgeUserAllowedGroups = "user_allowed_groups" |
| |
| Table = "users" |
| |
| APIKeysTable = "api_keys" |
| |
| |
| APIKeysInverseTable = "api_keys" |
| |
| APIKeysColumn = "user_id" |
| |
| RedeemCodesTable = "redeem_codes" |
| |
| |
| RedeemCodesInverseTable = "redeem_codes" |
| |
| RedeemCodesColumn = "used_by" |
| |
| SubscriptionsTable = "user_subscriptions" |
| |
| |
| SubscriptionsInverseTable = "user_subscriptions" |
| |
| SubscriptionsColumn = "user_id" |
| |
| AssignedSubscriptionsTable = "user_subscriptions" |
| |
| |
| AssignedSubscriptionsInverseTable = "user_subscriptions" |
| |
| AssignedSubscriptionsColumn = "assigned_by" |
| |
| AnnouncementReadsTable = "announcement_reads" |
| |
| |
| AnnouncementReadsInverseTable = "announcement_reads" |
| |
| AnnouncementReadsColumn = "user_id" |
| |
| AllowedGroupsTable = "user_allowed_groups" |
| |
| |
| AllowedGroupsInverseTable = "groups" |
| |
| UsageLogsTable = "usage_logs" |
| |
| |
| UsageLogsInverseTable = "usage_logs" |
| |
| UsageLogsColumn = "user_id" |
| |
| AttributeValuesTable = "user_attribute_values" |
| |
| |
| AttributeValuesInverseTable = "user_attribute_values" |
| |
| AttributeValuesColumn = "user_id" |
| |
| PromoCodeUsagesTable = "promo_code_usages" |
| |
| |
| PromoCodeUsagesInverseTable = "promo_code_usages" |
| |
| PromoCodeUsagesColumn = "user_id" |
| |
| UserAllowedGroupsTable = "user_allowed_groups" |
| |
| |
| UserAllowedGroupsInverseTable = "user_allowed_groups" |
| |
| UserAllowedGroupsColumn = "user_id" |
| ) |
|
|
| |
| var Columns = []string{ |
| FieldID, |
| FieldCreatedAt, |
| FieldUpdatedAt, |
| FieldDeletedAt, |
| FieldEmail, |
| FieldPasswordHash, |
| FieldRole, |
| FieldBalance, |
| FieldConcurrency, |
| FieldStatus, |
| FieldUsername, |
| FieldNotes, |
| FieldTotpSecretEncrypted, |
| FieldTotpEnabled, |
| FieldTotpEnabledAt, |
| FieldSoraStorageQuotaBytes, |
| FieldSoraStorageUsedBytes, |
| } |
|
|
| var ( |
| |
| |
| AllowedGroupsPrimaryKey = []string{"user_id", "group_id"} |
| ) |
|
|
| |
| func ValidColumn(column string) bool { |
| for i := range Columns { |
| if column == Columns[i] { |
| return true |
| } |
| } |
| return false |
| } |
|
|
| |
| |
| |
| |
| |
| var ( |
| Hooks [1]ent.Hook |
| Interceptors [1]ent.Interceptor |
| |
| DefaultCreatedAt func() time.Time |
| |
| DefaultUpdatedAt func() time.Time |
| |
| UpdateDefaultUpdatedAt func() time.Time |
| |
| EmailValidator func(string) error |
| |
| PasswordHashValidator func(string) error |
| |
| DefaultRole string |
| |
| RoleValidator func(string) error |
| |
| DefaultBalance float64 |
| |
| DefaultConcurrency int |
| |
| DefaultStatus string |
| |
| StatusValidator func(string) error |
| |
| DefaultUsername string |
| |
| UsernameValidator func(string) error |
| |
| DefaultNotes string |
| |
| DefaultTotpEnabled bool |
| |
| DefaultSoraStorageQuotaBytes int64 |
| |
| DefaultSoraStorageUsedBytes int64 |
| ) |
|
|
| |
| type OrderOption func(*sql.Selector) |
|
|
| |
| func ByID(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldID, opts...).ToFunc() |
| } |
|
|
| |
| func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() |
| } |
|
|
| |
| func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() |
| } |
|
|
| |
| func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldDeletedAt, opts...).ToFunc() |
| } |
|
|
| |
| func ByEmail(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldEmail, opts...).ToFunc() |
| } |
|
|
| |
| func ByPasswordHash(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldPasswordHash, opts...).ToFunc() |
| } |
|
|
| |
| func ByRole(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldRole, opts...).ToFunc() |
| } |
|
|
| |
| func ByBalance(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldBalance, opts...).ToFunc() |
| } |
|
|
| |
| func ByConcurrency(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldConcurrency, opts...).ToFunc() |
| } |
|
|
| |
| func ByStatus(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldStatus, opts...).ToFunc() |
| } |
|
|
| |
| func ByUsername(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldUsername, opts...).ToFunc() |
| } |
|
|
| |
| func ByNotes(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldNotes, opts...).ToFunc() |
| } |
|
|
| |
| func ByTotpSecretEncrypted(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldTotpSecretEncrypted, opts...).ToFunc() |
| } |
|
|
| |
| func ByTotpEnabled(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldTotpEnabled, opts...).ToFunc() |
| } |
|
|
| |
| func ByTotpEnabledAt(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldTotpEnabledAt, opts...).ToFunc() |
| } |
|
|
| |
| func BySoraStorageQuotaBytes(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldSoraStorageQuotaBytes, opts...).ToFunc() |
| } |
|
|
| |
| func BySoraStorageUsedBytes(opts ...sql.OrderTermOption) OrderOption { |
| return sql.OrderByField(FieldSoraStorageUsedBytes, opts...).ToFunc() |
| } |
|
|
| |
| func ByAPIKeysCount(opts ...sql.OrderTermOption) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborsCount(s, newAPIKeysStep(), opts...) |
| } |
| } |
|
|
| |
| func ByAPIKeys(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborTerms(s, newAPIKeysStep(), append([]sql.OrderTerm{term}, terms...)...) |
| } |
| } |
|
|
| |
| func ByRedeemCodesCount(opts ...sql.OrderTermOption) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborsCount(s, newRedeemCodesStep(), opts...) |
| } |
| } |
|
|
| |
| func ByRedeemCodes(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborTerms(s, newRedeemCodesStep(), append([]sql.OrderTerm{term}, terms...)...) |
| } |
| } |
|
|
| |
| func BySubscriptionsCount(opts ...sql.OrderTermOption) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborsCount(s, newSubscriptionsStep(), opts...) |
| } |
| } |
|
|
| |
| func BySubscriptions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborTerms(s, newSubscriptionsStep(), append([]sql.OrderTerm{term}, terms...)...) |
| } |
| } |
|
|
| |
| func ByAssignedSubscriptionsCount(opts ...sql.OrderTermOption) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborsCount(s, newAssignedSubscriptionsStep(), opts...) |
| } |
| } |
|
|
| |
| func ByAssignedSubscriptions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborTerms(s, newAssignedSubscriptionsStep(), append([]sql.OrderTerm{term}, terms...)...) |
| } |
| } |
|
|
| |
| func ByAnnouncementReadsCount(opts ...sql.OrderTermOption) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborsCount(s, newAnnouncementReadsStep(), opts...) |
| } |
| } |
|
|
| |
| func ByAnnouncementReads(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborTerms(s, newAnnouncementReadsStep(), append([]sql.OrderTerm{term}, terms...)...) |
| } |
| } |
|
|
| |
| func ByAllowedGroupsCount(opts ...sql.OrderTermOption) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborsCount(s, newAllowedGroupsStep(), opts...) |
| } |
| } |
|
|
| |
| func ByAllowedGroups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborTerms(s, newAllowedGroupsStep(), append([]sql.OrderTerm{term}, terms...)...) |
| } |
| } |
|
|
| |
| func ByUsageLogsCount(opts ...sql.OrderTermOption) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborsCount(s, newUsageLogsStep(), opts...) |
| } |
| } |
|
|
| |
| func ByUsageLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborTerms(s, newUsageLogsStep(), append([]sql.OrderTerm{term}, terms...)...) |
| } |
| } |
|
|
| |
| func ByAttributeValuesCount(opts ...sql.OrderTermOption) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborsCount(s, newAttributeValuesStep(), opts...) |
| } |
| } |
|
|
| |
| func ByAttributeValues(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborTerms(s, newAttributeValuesStep(), append([]sql.OrderTerm{term}, terms...)...) |
| } |
| } |
|
|
| |
| func ByPromoCodeUsagesCount(opts ...sql.OrderTermOption) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborsCount(s, newPromoCodeUsagesStep(), opts...) |
| } |
| } |
|
|
| |
| func ByPromoCodeUsages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborTerms(s, newPromoCodeUsagesStep(), append([]sql.OrderTerm{term}, terms...)...) |
| } |
| } |
|
|
| |
| func ByUserAllowedGroupsCount(opts ...sql.OrderTermOption) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborsCount(s, newUserAllowedGroupsStep(), opts...) |
| } |
| } |
|
|
| |
| func ByUserAllowedGroups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { |
| return func(s *sql.Selector) { |
| sqlgraph.OrderByNeighborTerms(s, newUserAllowedGroupsStep(), append([]sql.OrderTerm{term}, terms...)...) |
| } |
| } |
| func newAPIKeysStep() *sqlgraph.Step { |
| return sqlgraph.NewStep( |
| sqlgraph.From(Table, FieldID), |
| sqlgraph.To(APIKeysInverseTable, FieldID), |
| sqlgraph.Edge(sqlgraph.O2M, false, APIKeysTable, APIKeysColumn), |
| ) |
| } |
| func newRedeemCodesStep() *sqlgraph.Step { |
| return sqlgraph.NewStep( |
| sqlgraph.From(Table, FieldID), |
| sqlgraph.To(RedeemCodesInverseTable, FieldID), |
| sqlgraph.Edge(sqlgraph.O2M, false, RedeemCodesTable, RedeemCodesColumn), |
| ) |
| } |
| func newSubscriptionsStep() *sqlgraph.Step { |
| return sqlgraph.NewStep( |
| sqlgraph.From(Table, FieldID), |
| sqlgraph.To(SubscriptionsInverseTable, FieldID), |
| sqlgraph.Edge(sqlgraph.O2M, false, SubscriptionsTable, SubscriptionsColumn), |
| ) |
| } |
| func newAssignedSubscriptionsStep() *sqlgraph.Step { |
| return sqlgraph.NewStep( |
| sqlgraph.From(Table, FieldID), |
| sqlgraph.To(AssignedSubscriptionsInverseTable, FieldID), |
| sqlgraph.Edge(sqlgraph.O2M, false, AssignedSubscriptionsTable, AssignedSubscriptionsColumn), |
| ) |
| } |
| func newAnnouncementReadsStep() *sqlgraph.Step { |
| return sqlgraph.NewStep( |
| sqlgraph.From(Table, FieldID), |
| sqlgraph.To(AnnouncementReadsInverseTable, FieldID), |
| sqlgraph.Edge(sqlgraph.O2M, false, AnnouncementReadsTable, AnnouncementReadsColumn), |
| ) |
| } |
| func newAllowedGroupsStep() *sqlgraph.Step { |
| return sqlgraph.NewStep( |
| sqlgraph.From(Table, FieldID), |
| sqlgraph.To(AllowedGroupsInverseTable, FieldID), |
| sqlgraph.Edge(sqlgraph.M2M, false, AllowedGroupsTable, AllowedGroupsPrimaryKey...), |
| ) |
| } |
| func newUsageLogsStep() *sqlgraph.Step { |
| return sqlgraph.NewStep( |
| sqlgraph.From(Table, FieldID), |
| sqlgraph.To(UsageLogsInverseTable, FieldID), |
| sqlgraph.Edge(sqlgraph.O2M, false, UsageLogsTable, UsageLogsColumn), |
| ) |
| } |
| func newAttributeValuesStep() *sqlgraph.Step { |
| return sqlgraph.NewStep( |
| sqlgraph.From(Table, FieldID), |
| sqlgraph.To(AttributeValuesInverseTable, FieldID), |
| sqlgraph.Edge(sqlgraph.O2M, false, AttributeValuesTable, AttributeValuesColumn), |
| ) |
| } |
| func newPromoCodeUsagesStep() *sqlgraph.Step { |
| return sqlgraph.NewStep( |
| sqlgraph.From(Table, FieldID), |
| sqlgraph.To(PromoCodeUsagesInverseTable, FieldID), |
| sqlgraph.Edge(sqlgraph.O2M, false, PromoCodeUsagesTable, PromoCodeUsagesColumn), |
| ) |
| } |
| func newUserAllowedGroupsStep() *sqlgraph.Step { |
| return sqlgraph.NewStep( |
| sqlgraph.From(Table, FieldID), |
| sqlgraph.To(UserAllowedGroupsInverseTable, UserAllowedGroupsColumn), |
| sqlgraph.Edge(sqlgraph.O2M, true, UserAllowedGroupsTable, UserAllowedGroupsColumn), |
| ) |
| } |
|
|