mirror of https://github.com/cloudreve/Cloudreve
225 lines
8.2 KiB
Go
225 lines
8.2 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package entity
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the entity type in the database.
|
|
Label = "entity"
|
|
// 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"
|
|
// FieldType holds the string denoting the type field in the database.
|
|
FieldType = "type"
|
|
// FieldSource holds the string denoting the source field in the database.
|
|
FieldSource = "source"
|
|
// FieldSize holds the string denoting the size field in the database.
|
|
FieldSize = "size"
|
|
// FieldReferenceCount holds the string denoting the reference_count field in the database.
|
|
FieldReferenceCount = "reference_count"
|
|
// FieldStoragePolicyEntities holds the string denoting the storage_policy_entities field in the database.
|
|
FieldStoragePolicyEntities = "storage_policy_entities"
|
|
// FieldCreatedBy holds the string denoting the created_by field in the database.
|
|
FieldCreatedBy = "created_by"
|
|
// FieldUploadSessionID holds the string denoting the upload_session_id field in the database.
|
|
FieldUploadSessionID = "upload_session_id"
|
|
// FieldRecycleOptions holds the string denoting the recycle_options field in the database.
|
|
FieldRecycleOptions = "recycle_options"
|
|
// EdgeFile holds the string denoting the file edge name in mutations.
|
|
EdgeFile = "file"
|
|
// EdgeUser holds the string denoting the user edge name in mutations.
|
|
EdgeUser = "user"
|
|
// EdgeStoragePolicy holds the string denoting the storage_policy edge name in mutations.
|
|
EdgeStoragePolicy = "storage_policy"
|
|
// Table holds the table name of the entity in the database.
|
|
Table = "entities"
|
|
// FileTable is the table that holds the file relation/edge. The primary key declared below.
|
|
FileTable = "file_entities"
|
|
// FileInverseTable is the table name for the File entity.
|
|
// It exists in this package in order to avoid circular dependency with the "file" package.
|
|
FileInverseTable = "files"
|
|
// UserTable is the table that holds the user relation/edge.
|
|
UserTable = "entities"
|
|
// UserInverseTable is the table name for the User entity.
|
|
// It exists in this package in order to avoid circular dependency with the "user" package.
|
|
UserInverseTable = "users"
|
|
// UserColumn is the table column denoting the user relation/edge.
|
|
UserColumn = "created_by"
|
|
// StoragePolicyTable is the table that holds the storage_policy relation/edge.
|
|
StoragePolicyTable = "entities"
|
|
// StoragePolicyInverseTable is the table name for the StoragePolicy entity.
|
|
// It exists in this package in order to avoid circular dependency with the "storagepolicy" package.
|
|
StoragePolicyInverseTable = "storage_policies"
|
|
// StoragePolicyColumn is the table column denoting the storage_policy relation/edge.
|
|
StoragePolicyColumn = "storage_policy_entities"
|
|
)
|
|
|
|
// Columns holds all SQL columns for entity fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
FieldDeletedAt,
|
|
FieldType,
|
|
FieldSource,
|
|
FieldSize,
|
|
FieldReferenceCount,
|
|
FieldStoragePolicyEntities,
|
|
FieldCreatedBy,
|
|
FieldUploadSessionID,
|
|
FieldRecycleOptions,
|
|
}
|
|
|
|
var (
|
|
// FilePrimaryKey and FileColumn2 are the table columns denoting the
|
|
// primary key for the file relation (M2M).
|
|
FilePrimaryKey = []string{"file_id", "entity_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
|
|
// DefaultReferenceCount holds the default value on creation for the "reference_count" field.
|
|
DefaultReferenceCount int
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Entity 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()
|
|
}
|
|
|
|
// ByType orders the results by the type field.
|
|
func ByType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldType, opts...).ToFunc()
|
|
}
|
|
|
|
// BySource orders the results by the source field.
|
|
func BySource(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldSource, opts...).ToFunc()
|
|
}
|
|
|
|
// BySize orders the results by the size field.
|
|
func BySize(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldSize, opts...).ToFunc()
|
|
}
|
|
|
|
// ByReferenceCount orders the results by the reference_count field.
|
|
func ByReferenceCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldReferenceCount, opts...).ToFunc()
|
|
}
|
|
|
|
// ByStoragePolicyEntities orders the results by the storage_policy_entities field.
|
|
func ByStoragePolicyEntities(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldStoragePolicyEntities, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCreatedBy orders the results by the created_by field.
|
|
func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUploadSessionID orders the results by the upload_session_id field.
|
|
func ByUploadSessionID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUploadSessionID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByFileCount orders the results by file count.
|
|
func ByFileCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newFileStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByFile orders the results by file terms.
|
|
func ByFile(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newFileStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByUserField orders the results by user field.
|
|
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
|
|
// ByStoragePolicyField orders the results by storage_policy field.
|
|
func ByStoragePolicyField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newStoragePolicyStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
func newFileStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(FileInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, FileTable, FilePrimaryKey...),
|
|
)
|
|
}
|
|
func newUserStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(UserInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
|
|
)
|
|
}
|
|
func newStoragePolicyStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(StoragePolicyInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, StoragePolicyTable, StoragePolicyColumn),
|
|
)
|
|
}
|