// Code generated by ent, DO NOT EDIT. package metadata import ( "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" ) const ( // Label holds the string label denoting the metadata type in the database. Label = "metadata" // 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" // FieldValue holds the string denoting the value field in the database. FieldValue = "value" // FieldFileID holds the string denoting the file_id field in the database. FieldFileID = "file_id" // FieldIsPublic holds the string denoting the is_public field in the database. FieldIsPublic = "is_public" // EdgeFile holds the string denoting the file edge name in mutations. EdgeFile = "file" // Table holds the table name of the metadata in the database. Table = "metadata" // FileTable is the table that holds the file relation/edge. FileTable = "metadata" // 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" // FileColumn is the table column denoting the file relation/edge. FileColumn = "file_id" ) // Columns holds all SQL columns for metadata fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, FieldDeletedAt, FieldName, FieldValue, FieldFileID, FieldIsPublic, } // 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 // DefaultIsPublic holds the default value on creation for the "is_public" field. DefaultIsPublic bool ) // OrderOption defines the ordering options for the Metadata 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() } // ByValue orders the results by the value field. func ByValue(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldValue, opts...).ToFunc() } // ByFileID orders the results by the file_id field. func ByFileID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldFileID, opts...).ToFunc() } // ByIsPublic orders the results by the is_public field. func ByIsPublic(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldIsPublic, opts...).ToFunc() } // ByFileField orders the results by file field. func ByFileField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newFileStep(), sql.OrderByField(field, opts...)) } } func newFileStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(FileInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, FileTable, FileColumn), ) }