// Code generated by ent, DO NOT EDIT. package episode import ( "fmt" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" ) const ( // Label holds the string label denoting the episode type in the database. Label = "episode" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldMediaID holds the string denoting the media_id field in the database. FieldMediaID = "media_id" // FieldSeasonNumber holds the string denoting the season_number field in the database. FieldSeasonNumber = "season_number" // FieldEpisodeNumber holds the string denoting the episode_number field in the database. FieldEpisodeNumber = "episode_number" // FieldTitle holds the string denoting the title field in the database. FieldTitle = "title" // FieldOverview holds the string denoting the overview field in the database. FieldOverview = "overview" // FieldAirDate holds the string denoting the air_date field in the database. FieldAirDate = "air_date" // FieldStatus holds the string denoting the status field in the database. FieldStatus = "status" // EdgeMedia holds the string denoting the media edge name in mutations. EdgeMedia = "media" // Table holds the table name of the episode in the database. Table = "episodes" // MediaTable is the table that holds the media relation/edge. MediaTable = "episodes" // MediaInverseTable is the table name for the Media entity. // It exists in this package in order to avoid circular dependency with the "media" package. MediaInverseTable = "media" // MediaColumn is the table column denoting the media relation/edge. MediaColumn = "media_id" ) // Columns holds all SQL columns for episode fields. var Columns = []string{ FieldID, FieldMediaID, FieldSeasonNumber, FieldEpisodeNumber, FieldTitle, FieldOverview, FieldAirDate, FieldStatus, } // 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 } // Status defines the type for the "status" enum field. type Status string // StatusMissing is the default value of the Status enum. const DefaultStatus = StatusMissing // Status values. const ( StatusMissing Status = "missing" StatusDownloading Status = "downloading" StatusDownloaded Status = "downloaded" ) func (s Status) String() string { return string(s) } // StatusValidator is a validator for the "status" field enum values. It is called by the builders before save. func StatusValidator(s Status) error { switch s { case StatusMissing, StatusDownloading, StatusDownloaded: return nil default: return fmt.Errorf("episode: invalid enum value for status field: %q", s) } } // OrderOption defines the ordering options for the Episode 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() } // ByMediaID orders the results by the media_id field. func ByMediaID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMediaID, opts...).ToFunc() } // BySeasonNumber orders the results by the season_number field. func BySeasonNumber(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSeasonNumber, opts...).ToFunc() } // ByEpisodeNumber orders the results by the episode_number field. func ByEpisodeNumber(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldEpisodeNumber, opts...).ToFunc() } // ByTitle orders the results by the title field. func ByTitle(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldTitle, opts...).ToFunc() } // ByOverview orders the results by the overview field. func ByOverview(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldOverview, opts...).ToFunc() } // ByAirDate orders the results by the air_date field. func ByAirDate(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAirDate, opts...).ToFunc() } // ByStatus orders the results by the status field. func ByStatus(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStatus, opts...).ToFunc() } // ByMediaField orders the results by media field. func ByMediaField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newMediaStep(), sql.OrderByField(field, opts...)) } } func newMediaStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(MediaInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, MediaTable, MediaColumn), ) }