// Code generated by ent, DO NOT EDIT. package group import ( "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 group type in the database. Label = "group" // 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" // FieldName holds the string denoting the name field in the database. FieldName = "name" // FieldMaxStorage holds the string denoting the max_storage field in the database. FieldMaxStorage = "max_storage" // FieldSpeedLimit holds the string denoting the speed_limit field in the database. FieldSpeedLimit = "speed_limit" // FieldPermissions holds the string denoting the permissions field in the database. FieldPermissions = "permissions" // FieldSettings holds the string denoting the settings field in the database. FieldSettings = "settings" // FieldStoragePolicyID holds the string denoting the storage_policy_id field in the database. FieldStoragePolicyID = "storage_policy_id" // EdgeUsers holds the string denoting the users edge name in mutations. EdgeUsers = "users" // EdgeStoragePolicies holds the string denoting the storage_policies edge name in mutations. EdgeStoragePolicies = "storage_policies" // EdgeUserGroup holds the string denoting the user_group edge name in mutations. EdgeUserGroup = "user_group" // Table holds the table name of the group in the database. Table = "groups" // UsersTable is the table that holds the users relation/edge. The primary key declared below. UsersTable = "user_groups" // UsersInverseTable is the table name for the User entity. // It exists in this package in order to avoid circular dependency with the "user" package. UsersInverseTable = "users" // StoragePoliciesTable is the table that holds the storage_policies relation/edge. StoragePoliciesTable = "groups" // StoragePoliciesInverseTable is the table name for the StoragePolicy entity. // It exists in this package in order to avoid circular dependency with the "storagepolicy" package. StoragePoliciesInverseTable = "storage_policies" // StoragePoliciesColumn is the table column denoting the storage_policies relation/edge. StoragePoliciesColumn = "storage_policy_id" // UserGroupTable is the table that holds the user_group relation/edge. UserGroupTable = "user_groups" // UserGroupInverseTable is the table name for the UserGroup entity. // It exists in this package in order to avoid circular dependency with the "usergroup" package. UserGroupInverseTable = "user_groups" // UserGroupColumn is the table column denoting the user_group relation/edge. UserGroupColumn = "group_id" ) // Columns holds all SQL columns for group fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, FieldDeletedAt, FieldName, FieldMaxStorage, FieldSpeedLimit, FieldPermissions, FieldSettings, FieldStoragePolicyID, } var ( // UsersPrimaryKey and UsersColumn2 are the table columns denoting the // primary key for the users relation (M2M). UsersPrimaryKey = []string{"group_id", "user_id"} ) // 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 // DefaultSettings holds the default value on creation for the "settings" field. DefaultSettings *types.GroupSetting ) // OrderOption defines the ordering options for the Group 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() } // ByName orders the results by the name field. func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() } // ByMaxStorage orders the results by the max_storage field. func ByMaxStorage(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMaxStorage, opts...).ToFunc() } // BySpeedLimit orders the results by the speed_limit field. func BySpeedLimit(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSpeedLimit, opts...).ToFunc() } // ByStoragePolicyID orders the results by the storage_policy_id field. func ByStoragePolicyID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStoragePolicyID, opts...).ToFunc() } // ByUsersCount orders the results by users count. func ByUsersCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newUsersStep(), opts...) } } // ByUsers orders the results by users terms. func ByUsers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newUsersStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByStoragePoliciesField orders the results by storage_policies field. func ByStoragePoliciesField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newStoragePoliciesStep(), sql.OrderByField(field, opts...)) } } // ByUserGroupCount orders the results by user_group count. func ByUserGroupCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newUserGroupStep(), opts...) } } // ByUserGroup orders the results by user_group terms. func ByUserGroup(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newUserGroupStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newUsersStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(UsersInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2M, false, UsersTable, UsersPrimaryKey...), ) } func newStoragePoliciesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(StoragePoliciesInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, StoragePoliciesTable, StoragePoliciesColumn), ) } func newUserGroupStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(UserGroupInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, true, UserGroupTable, UserGroupColumn), ) }