// Code generated by ent, DO NOT EDIT. package dailycategorycontent import ( "fmt" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" ) const ( // Label holds the string label denoting the dailycategorycontent type in the database. Label = "daily_category_content" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldLanguageCode holds the string denoting the language_code field in the database. FieldLanguageCode = "language_code" // FieldName holds the string denoting the name field in the database. FieldName = "name" // EdgeCategory holds the string denoting the category edge name in mutations. EdgeCategory = "category" // Table holds the table name of the dailycategorycontent in the database. Table = "daily_category_contents" // CategoryTable is the table that holds the category relation/edge. CategoryTable = "daily_category_contents" // CategoryInverseTable is the table name for the DailyCategory entity. // It exists in this package in order to avoid circular dependency with the "dailycategory" package. CategoryInverseTable = "daily_categories" // CategoryColumn is the table column denoting the category relation/edge. CategoryColumn = "daily_category_contents" ) // Columns holds all SQL columns for dailycategorycontent fields. var Columns = []string{ FieldID, FieldLanguageCode, FieldName, } // ForeignKeys holds the SQL foreign-keys that are owned by the "daily_category_contents" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "daily_category_contents", } // 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 ( // NameValidator is a validator for the "name" field. It is called by the builders before save. NameValidator func(string) error ) // LanguageCode defines the type for the "language_code" enum field. type LanguageCode string // LanguageCode values. const ( LanguageCodeEn LanguageCode = "en" LanguageCodeZhHans LanguageCode = "zh-Hans" LanguageCodeZhHant LanguageCode = "zh-Hant" ) func (lc LanguageCode) String() string { return string(lc) } // LanguageCodeValidator is a validator for the "language_code" field enum values. It is called by the builders before save. func LanguageCodeValidator(lc LanguageCode) error { switch lc { case LanguageCodeEn, LanguageCodeZhHans, LanguageCodeZhHant: return nil default: return fmt.Errorf("dailycategorycontent: invalid enum value for language_code field: %q", lc) } } // OrderOption defines the ordering options for the DailyCategoryContent 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() } // ByLanguageCode orders the results by the language_code field. func ByLanguageCode(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLanguageCode, opts...).ToFunc() } // ByName orders the results by the name field. func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() } // ByCategoryField orders the results by category field. func ByCategoryField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newCategoryStep(), sql.OrderByField(field, opts...)) } } func newCategoryStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(CategoryInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, CategoryTable, CategoryColumn), ) }