121 lines
3.6 KiB
Go
121 lines
3.6 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package dailycontent
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the dailycontent type in the database.
|
|
Label = "daily_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"
|
|
// FieldQuote holds the string denoting the quote field in the database.
|
|
FieldQuote = "quote"
|
|
// EdgeDaily holds the string denoting the daily edge name in mutations.
|
|
EdgeDaily = "daily"
|
|
// Table holds the table name of the dailycontent in the database.
|
|
Table = "daily_contents"
|
|
// DailyTable is the table that holds the daily relation/edge.
|
|
DailyTable = "daily_contents"
|
|
// DailyInverseTable is the table name for the Daily entity.
|
|
// It exists in this package in order to avoid circular dependency with the "daily" package.
|
|
DailyInverseTable = "dailies"
|
|
// DailyColumn is the table column denoting the daily relation/edge.
|
|
DailyColumn = "daily_contents"
|
|
)
|
|
|
|
// Columns holds all SQL columns for dailycontent fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldLanguageCode,
|
|
FieldQuote,
|
|
}
|
|
|
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "daily_contents"
|
|
// table and are not defined as standalone fields in the schema.
|
|
var ForeignKeys = []string{
|
|
"daily_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 (
|
|
// QuoteValidator is a validator for the "quote" field. It is called by the builders before save.
|
|
QuoteValidator func(string) error
|
|
)
|
|
|
|
// LanguageCode defines the type for the "language_code" enum field.
|
|
type LanguageCode string
|
|
|
|
// LanguageCode values.
|
|
const (
|
|
LanguageCodeEN LanguageCode = "en"
|
|
LanguageCodeZH_HANS LanguageCode = "zh-Hans"
|
|
LanguageCodeZH_HANT 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, LanguageCodeZH_HANS, LanguageCodeZH_HANT:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("dailycontent: invalid enum value for language_code field: %q", lc)
|
|
}
|
|
}
|
|
|
|
// OrderOption defines the ordering options for the DailyContent 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()
|
|
}
|
|
|
|
// ByQuote orders the results by the quote field.
|
|
func ByQuote(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldQuote, opts...).ToFunc()
|
|
}
|
|
|
|
// ByDailyField orders the results by daily field.
|
|
func ByDailyField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newDailyStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
func newDailyStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(DailyInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, DailyTable, DailyColumn),
|
|
)
|
|
}
|