Files
polaris/ent/series/series.go
2024-07-14 11:59:06 +08:00

170 lines
5.7 KiB
Go

// Code generated by ent, DO NOT EDIT.
package series
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the series type in the database.
Label = "series"
// 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"
// 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"
// FieldPosterPath holds the string denoting the poster_path field in the database.
FieldPosterPath = "poster_path"
// 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"
// EdgeEpisodes holds the string denoting the episodes edge name in mutations.
EdgeEpisodes = "episodes"
// Table holds the table name of the series in the database.
Table = "series"
// 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 = "series_id"
)
// Columns holds all SQL columns for series fields.
var Columns = []string{
FieldID,
FieldTmdbID,
FieldImdbID,
FieldNameCn,
FieldNameEn,
FieldOriginalName,
FieldOverview,
FieldPosterPath,
FieldCreatedAt,
FieldAirDate,
FieldResolution,
FieldStorageID,
}
// 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
// DefaultResolution holds the default value on creation for the "resolution" field.
DefaultResolution string
)
// OrderOption defines the ordering options for the Series 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()
}
// 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()
}
// ByPosterPath orders the results by the poster_path field.
func ByPosterPath(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPosterPath, 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()
}
// 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),
)
}