// Code generated by ent, DO NOT EDIT. package media import ( "fmt" "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" // FieldTmdbID holds the string denoting the tmdb_id field in the database. FieldTmdbID = "tmdb_id" // FieldImdbID holds the string denoting the imdb_id field in the database. FieldImdbID = "imdb_id" // FieldMediaType holds the string denoting the media_type field in the database. FieldMediaType = "media_type" // FieldNameCn holds the string denoting the name_cn field in the database. FieldNameCn = "name_cn" // FieldNameEn holds the string denoting the name_en field in the database. FieldNameEn = "name_en" // FieldOriginalName holds the string denoting the original_name field in the database. FieldOriginalName = "original_name" // FieldOverview holds the string denoting the overview field in the database. FieldOverview = "overview" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldAirDate holds the string denoting the air_date field in the database. FieldAirDate = "air_date" // FieldResolution holds the string denoting the resolution field in the database. FieldResolution = "resolution" // FieldStorageID holds the string denoting the storage_id field in the database. FieldStorageID = "storage_id" // FieldTargetDir holds the string denoting the target_dir field in the database. FieldTargetDir = "target_dir" // FieldDownloadHistoryEpisodes holds the string denoting the download_history_episodes field in the database. FieldDownloadHistoryEpisodes = "download_history_episodes" // FieldLimiter holds the string denoting the limiter field in the database. FieldLimiter = "limiter" // FieldExtras holds the string denoting the extras field in the database. FieldExtras = "extras" // FieldAlternativeTitles holds the string denoting the alternative_titles field in the database. FieldAlternativeTitles = "alternative_titles" // FieldCreateTime holds the string denoting the create_time field in the database. FieldCreateTime = "create_time" // EdgeEpisodes holds the string denoting the episodes edge name in mutations. EdgeEpisodes = "episodes" // Table holds the table name of the media in the database. Table = "media" // EpisodesTable is the table that holds the episodes relation/edge. EpisodesTable = "episodes" // EpisodesInverseTable is the table name for the Episode entity. // It exists in this package in order to avoid circular dependency with the "episode" package. EpisodesInverseTable = "episodes" // EpisodesColumn is the table column denoting the episodes relation/edge. EpisodesColumn = "media_id" ) // Columns holds all SQL columns for media fields. var Columns = []string{ FieldID, FieldTmdbID, FieldImdbID, FieldMediaType, FieldNameCn, FieldNameEn, FieldOriginalName, FieldOverview, FieldCreatedAt, FieldAirDate, FieldResolution, FieldStorageID, FieldTargetDir, FieldDownloadHistoryEpisodes, FieldLimiter, FieldExtras, FieldAlternativeTitles, FieldCreateTime, } // 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 } var ( // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt time.Time // DefaultAirDate holds the default value on creation for the "air_date" field. DefaultAirDate string // DefaultDownloadHistoryEpisodes holds the default value on creation for the "download_history_episodes" field. DefaultDownloadHistoryEpisodes bool // DefaultCreateTime holds the default value on creation for the "create_time" field. DefaultCreateTime func() time.Time ) // MediaType defines the type for the "media_type" enum field. type MediaType string // MediaType values. const ( MediaTypeTv MediaType = "tv" MediaTypeMovie MediaType = "movie" ) func (mt MediaType) String() string { return string(mt) } // MediaTypeValidator is a validator for the "media_type" field enum values. It is called by the builders before save. func MediaTypeValidator(mt MediaType) error { switch mt { case MediaTypeTv, MediaTypeMovie: return nil default: return fmt.Errorf("media: invalid enum value for media_type field: %q", mt) } } // Resolution defines the type for the "resolution" enum field. type Resolution string // Resolution1080p is the default value of the Resolution enum. const DefaultResolution = Resolution1080p // Resolution values. const ( Resolution720p Resolution = "720p" Resolution1080p Resolution = "1080p" Resolution2160p Resolution = "2160p" ResolutionAny Resolution = "any" ) func (r Resolution) String() string { return string(r) } // ResolutionValidator is a validator for the "resolution" field enum values. It is called by the builders before save. func ResolutionValidator(r Resolution) error { switch r { case Resolution720p, Resolution1080p, Resolution2160p, ResolutionAny: return nil default: return fmt.Errorf("media: invalid enum value for resolution field: %q", r) } } // 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() } // ByTmdbID orders the results by the tmdb_id field. func ByTmdbID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldTmdbID, opts...).ToFunc() } // ByImdbID orders the results by the imdb_id field. func ByImdbID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldImdbID, opts...).ToFunc() } // ByMediaType orders the results by the media_type field. func ByMediaType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMediaType, opts...).ToFunc() } // ByNameCn orders the results by the name_cn field. func ByNameCn(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldNameCn, opts...).ToFunc() } // ByNameEn orders the results by the name_en field. func ByNameEn(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldNameEn, opts...).ToFunc() } // ByOriginalName orders the results by the original_name field. func ByOriginalName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldOriginalName, opts...).ToFunc() } // ByOverview orders the results by the overview field. func ByOverview(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldOverview, opts...).ToFunc() } // ByCreatedAt orders the results by the created_at field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() } // ByAirDate orders the results by the air_date field. func ByAirDate(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAirDate, opts...).ToFunc() } // ByResolution orders the results by the resolution field. func ByResolution(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldResolution, opts...).ToFunc() } // ByStorageID orders the results by the storage_id field. func ByStorageID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStorageID, opts...).ToFunc() } // ByTargetDir orders the results by the target_dir field. func ByTargetDir(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldTargetDir, opts...).ToFunc() } // ByDownloadHistoryEpisodes orders the results by the download_history_episodes field. func ByDownloadHistoryEpisodes(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDownloadHistoryEpisodes, opts...).ToFunc() } // ByCreateTime orders the results by the create_time field. func ByCreateTime(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreateTime, opts...).ToFunc() } // ByEpisodesCount orders the results by episodes count. func ByEpisodesCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newEpisodesStep(), opts...) } } // ByEpisodes orders the results by episodes terms. func ByEpisodes(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newEpisodesStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newEpisodesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(EpisodesInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, EpisodesTable, EpisodesColumn), ) }