144 lines
5 KiB
Go
144 lines
5 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package daily
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the daily type in the database.
|
|
Label = "daily"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldImageURL holds the string denoting the image_url field in the database.
|
|
FieldImageURL = "image_url"
|
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
|
FieldCreatedAt = "created_at"
|
|
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
|
FieldUpdatedAt = "updated_at"
|
|
// EdgeCategory holds the string denoting the category edge name in mutations.
|
|
EdgeCategory = "category"
|
|
// EdgeContents holds the string denoting the contents edge name in mutations.
|
|
EdgeContents = "contents"
|
|
// Table holds the table name of the daily in the database.
|
|
Table = "dailies"
|
|
// CategoryTable is the table that holds the category relation/edge.
|
|
CategoryTable = "dailies"
|
|
// CategoryInverseTable is the table name for the Category entity.
|
|
// It exists in this package in order to avoid circular dependency with the "category" package.
|
|
CategoryInverseTable = "categories"
|
|
// CategoryColumn is the table column denoting the category relation/edge.
|
|
CategoryColumn = "category_daily_items"
|
|
// ContentsTable is the table that holds the contents relation/edge.
|
|
ContentsTable = "daily_contents"
|
|
// ContentsInverseTable is the table name for the DailyContent entity.
|
|
// It exists in this package in order to avoid circular dependency with the "dailycontent" package.
|
|
ContentsInverseTable = "daily_contents"
|
|
// ContentsColumn is the table column denoting the contents relation/edge.
|
|
ContentsColumn = "daily_contents"
|
|
)
|
|
|
|
// Columns holds all SQL columns for daily fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldImageURL,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
}
|
|
|
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "dailies"
|
|
// table and are not defined as standalone fields in the schema.
|
|
var ForeignKeys = []string{
|
|
"category_daily_items",
|
|
"daily_category_daily_items",
|
|
}
|
|
|
|
// 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 (
|
|
// ImageURLValidator is a validator for the "image_url" field. It is called by the builders before save.
|
|
ImageURLValidator func(string) error
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
DefaultCreatedAt func() time.Time
|
|
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
|
DefaultUpdatedAt func() time.Time
|
|
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
|
UpdateDefaultUpdatedAt func() time.Time
|
|
// IDValidator is a validator for the "id" field. It is called by the builders before save.
|
|
IDValidator func(string) error
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Daily 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()
|
|
}
|
|
|
|
// ByImageURL orders the results by the image_url field.
|
|
func ByImageURL(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldImageURL, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCreatedAt orders the results by the created_at field.
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUpdatedAt orders the results by the updated_at field.
|
|
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUpdatedAt, 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...))
|
|
}
|
|
}
|
|
|
|
// ByContentsCount orders the results by contents count.
|
|
func ByContentsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newContentsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByContents orders the results by contents terms.
|
|
func ByContents(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newContentsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
func newCategoryStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(CategoryInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, CategoryTable, CategoryColumn),
|
|
)
|
|
}
|
|
func newContentsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(ContentsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, ContentsTable, ContentsColumn),
|
|
)
|
|
}
|