// Code generated by ent, DO NOT EDIT. package user import ( "fmt" "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/cloudreve/Cloudreve/v4/inventory/types" ) const ( // Label holds the string label denoting the user type in the database. Label = "user" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" // FieldDeletedAt holds the string denoting the deleted_at field in the database. FieldDeletedAt = "deleted_at" // FieldEmail holds the string denoting the email field in the database. FieldEmail = "email" // FieldNick holds the string denoting the nick field in the database. FieldNick = "nick" // FieldPassword holds the string denoting the password field in the database. FieldPassword = "password" // FieldStatus holds the string denoting the status field in the database. FieldStatus = "status" // FieldStorage holds the string denoting the storage field in the database. FieldStorage = "storage" // FieldTwoFactorSecret holds the string denoting the two_factor_secret field in the database. FieldTwoFactorSecret = "two_factor_secret" // FieldAvatar holds the string denoting the avatar field in the database. FieldAvatar = "avatar" // FieldSettings holds the string denoting the settings field in the database. FieldSettings = "settings" // FieldGroupUsers holds the string denoting the group_users field in the database. FieldGroupUsers = "group_users" // EdgeGroup holds the string denoting the group edge name in mutations. EdgeGroup = "group" // EdgeFiles holds the string denoting the files edge name in mutations. EdgeFiles = "files" // EdgeDavAccounts holds the string denoting the dav_accounts edge name in mutations. EdgeDavAccounts = "dav_accounts" // EdgeShares holds the string denoting the shares edge name in mutations. EdgeShares = "shares" // EdgePasskey holds the string denoting the passkey edge name in mutations. EdgePasskey = "passkey" // EdgeTasks holds the string denoting the tasks edge name in mutations. EdgeTasks = "tasks" // EdgeEntities holds the string denoting the entities edge name in mutations. EdgeEntities = "entities" // Table holds the table name of the user in the database. Table = "users" // GroupTable is the table that holds the group relation/edge. GroupTable = "users" // GroupInverseTable is the table name for the Group entity. // It exists in this package in order to avoid circular dependency with the "group" package. GroupInverseTable = "groups" // GroupColumn is the table column denoting the group relation/edge. GroupColumn = "group_users" // FilesTable is the table that holds the files relation/edge. FilesTable = "files" // FilesInverseTable is the table name for the File entity. // It exists in this package in order to avoid circular dependency with the "file" package. FilesInverseTable = "files" // FilesColumn is the table column denoting the files relation/edge. FilesColumn = "owner_id" // DavAccountsTable is the table that holds the dav_accounts relation/edge. DavAccountsTable = "dav_accounts" // DavAccountsInverseTable is the table name for the DavAccount entity. // It exists in this package in order to avoid circular dependency with the "davaccount" package. DavAccountsInverseTable = "dav_accounts" // DavAccountsColumn is the table column denoting the dav_accounts relation/edge. DavAccountsColumn = "owner_id" // SharesTable is the table that holds the shares relation/edge. SharesTable = "shares" // SharesInverseTable is the table name for the Share entity. // It exists in this package in order to avoid circular dependency with the "share" package. SharesInverseTable = "shares" // SharesColumn is the table column denoting the shares relation/edge. SharesColumn = "user_shares" // PasskeyTable is the table that holds the passkey relation/edge. PasskeyTable = "passkeys" // PasskeyInverseTable is the table name for the Passkey entity. // It exists in this package in order to avoid circular dependency with the "passkey" package. PasskeyInverseTable = "passkeys" // PasskeyColumn is the table column denoting the passkey relation/edge. PasskeyColumn = "user_id" // TasksTable is the table that holds the tasks relation/edge. TasksTable = "tasks" // TasksInverseTable is the table name for the Task entity. // It exists in this package in order to avoid circular dependency with the "task" package. TasksInverseTable = "tasks" // TasksColumn is the table column denoting the tasks relation/edge. TasksColumn = "user_tasks" // EntitiesTable is the table that holds the entities relation/edge. EntitiesTable = "entities" // EntitiesInverseTable is the table name for the Entity entity. // It exists in this package in order to avoid circular dependency with the "entity" package. EntitiesInverseTable = "entities" // EntitiesColumn is the table column denoting the entities relation/edge. EntitiesColumn = "created_by" ) // Columns holds all SQL columns for user fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, FieldDeletedAt, FieldEmail, FieldNick, FieldPassword, FieldStatus, FieldStorage, FieldTwoFactorSecret, FieldAvatar, FieldSettings, FieldGroupUsers, } // ValidColumn reports if the column name is valid (part of the table columns). func ValidColumn(column string) bool { for i := range Columns { if column == Columns[i] { return true } } return false } // Note that the variables below are initialized by the runtime // package on the initialization of the application. Therefore, // it should be imported in the main as follows: // // import _ "github.com/cloudreve/Cloudreve/v4/ent/runtime" var ( Hooks [1]ent.Hook Interceptors [1]ent.Interceptor // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. DefaultUpdatedAt func() time.Time // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. UpdateDefaultUpdatedAt func() time.Time // EmailValidator is a validator for the "email" field. It is called by the builders before save. EmailValidator func(string) error // NickValidator is a validator for the "nick" field. It is called by the builders before save. NickValidator func(string) error // DefaultStorage holds the default value on creation for the "storage" field. DefaultStorage int64 // DefaultSettings holds the default value on creation for the "settings" field. DefaultSettings *types.UserSetting ) // Status defines the type for the "status" enum field. type Status string // StatusActive is the default value of the Status enum. const DefaultStatus = StatusActive // Status values. const ( StatusActive Status = "active" StatusInactive Status = "inactive" StatusManualBanned Status = "manual_banned" StatusSysBanned Status = "sys_banned" ) func (s Status) String() string { return string(s) } // StatusValidator is a validator for the "status" field enum values. It is called by the builders before save. func StatusValidator(s Status) error { switch s { case StatusActive, StatusInactive, StatusManualBanned, StatusSysBanned: return nil default: return fmt.Errorf("user: invalid enum value for status field: %q", s) } } // OrderOption defines the ordering options for the User queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByCreatedAt orders the results by the created_at field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() } // ByUpdatedAt orders the results by the updated_at field. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() } // ByDeletedAt orders the results by the deleted_at field. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDeletedAt, opts...).ToFunc() } // ByEmail orders the results by the email field. func ByEmail(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldEmail, opts...).ToFunc() } // ByNick orders the results by the nick field. func ByNick(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldNick, opts...).ToFunc() } // ByPassword orders the results by the password field. func ByPassword(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPassword, opts...).ToFunc() } // ByStatus orders the results by the status field. func ByStatus(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStatus, opts...).ToFunc() } // ByStorage orders the results by the storage field. func ByStorage(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStorage, opts...).ToFunc() } // ByTwoFactorSecret orders the results by the two_factor_secret field. func ByTwoFactorSecret(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldTwoFactorSecret, opts...).ToFunc() } // ByAvatar orders the results by the avatar field. func ByAvatar(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAvatar, opts...).ToFunc() } // ByGroupUsers orders the results by the group_users field. func ByGroupUsers(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldGroupUsers, opts...).ToFunc() } // ByGroupField orders the results by group field. func ByGroupField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newGroupStep(), sql.OrderByField(field, opts...)) } } // ByFilesCount orders the results by files count. func ByFilesCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newFilesStep(), opts...) } } // ByFiles orders the results by files terms. func ByFiles(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newFilesStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByDavAccountsCount orders the results by dav_accounts count. func ByDavAccountsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newDavAccountsStep(), opts...) } } // ByDavAccounts orders the results by dav_accounts terms. func ByDavAccounts(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newDavAccountsStep(), append([]sql.OrderTerm{term}, terms...)...) } } // BySharesCount orders the results by shares count. func BySharesCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newSharesStep(), opts...) } } // ByShares orders the results by shares terms. func ByShares(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSharesStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByPasskeyCount orders the results by passkey count. func ByPasskeyCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newPasskeyStep(), opts...) } } // ByPasskey orders the results by passkey terms. func ByPasskey(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newPasskeyStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByTasksCount orders the results by tasks count. func ByTasksCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newTasksStep(), opts...) } } // ByTasks orders the results by tasks terms. func ByTasks(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newTasksStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByEntitiesCount orders the results by entities count. func ByEntitiesCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newEntitiesStep(), opts...) } } // ByEntities orders the results by entities terms. func ByEntities(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newEntitiesStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newGroupStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(GroupInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, GroupTable, GroupColumn), ) } func newFilesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(FilesInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, FilesTable, FilesColumn), ) } func newDavAccountsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(DavAccountsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, DavAccountsTable, DavAccountsColumn), ) } func newSharesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SharesInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, SharesTable, SharesColumn), ) } func newPasskeyStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(PasskeyInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, PasskeyTable, PasskeyColumn), ) } func newTasksStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(TasksInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, TasksTable, TasksColumn), ) } func newEntitiesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(EntitiesInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, EntitiesTable, EntitiesColumn), ) }