// Code generated by ent, DO NOT EDIT. package media import ( "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" ) const ( // Label holds the string label denoting the media type in the database. Label = "media" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldStorageID holds the string denoting the storage_id field in the database. FieldStorageID = "storage_id" // FieldOriginalName holds the string denoting the original_name field in the database. FieldOriginalName = "original_name" // FieldMimeType holds the string denoting the mime_type field in the database. FieldMimeType = "mime_type" // FieldSize holds the string denoting the size field in the database. FieldSize = "size" // FieldURL holds the string denoting the url field in the database. FieldURL = "url" // 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" // FieldCreatedBy holds the string denoting the created_by field in the database. FieldCreatedBy = "created_by" // EdgeOwner holds the string denoting the owner edge name in mutations. EdgeOwner = "owner" // Table holds the table name of the media in the database. Table = "media" // OwnerTable is the table that holds the owner relation/edge. OwnerTable = "media" // OwnerInverseTable is the table name for the User entity. // It exists in this package in order to avoid circular dependency with the "user" package. OwnerInverseTable = "users" // OwnerColumn is the table column denoting the owner relation/edge. OwnerColumn = "user_media" ) // Columns holds all SQL columns for media fields. var Columns = []string{ FieldID, FieldStorageID, FieldOriginalName, FieldMimeType, FieldSize, FieldURL, FieldCreatedAt, FieldUpdatedAt, FieldCreatedBy, } // ForeignKeys holds the SQL foreign-keys that are owned by the "media" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "user_media", } // 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 } } for i := range ForeignKeys { if column == ForeignKeys[i] { return true } } return false } var ( // StorageIDValidator is a validator for the "storage_id" field. It is called by the builders before save. StorageIDValidator func(string) error // OriginalNameValidator is a validator for the "original_name" field. It is called by the builders before save. OriginalNameValidator func(string) error // MimeTypeValidator is a validator for the "mime_type" field. It is called by the builders before save. MimeTypeValidator func(string) error // SizeValidator is a validator for the "size" field. It is called by the builders before save. SizeValidator func(int64) error // URLValidator is a validator for the "url" field. It is called by the builders before save. URLValidator func(string) error // 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 ) // OrderOption defines the ordering options for the Media 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() } // ByStorageID orders the results by the storage_id field. func ByStorageID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStorageID, opts...).ToFunc() } // ByOriginalName orders the results by the original_name field. func ByOriginalName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldOriginalName, opts...).ToFunc() } // ByMimeType orders the results by the mime_type field. func ByMimeType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMimeType, opts...).ToFunc() } // BySize orders the results by the size field. func BySize(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSize, opts...).ToFunc() } // ByURL orders the results by the url field. func ByURL(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldURL, 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() } // ByCreatedBy orders the results by the created_by field. func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedBy, opts...).ToFunc() } // ByOwnerField orders the results by owner field. func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...)) } } func newOwnerStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(OwnerInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn), ) }