157 lines
5.5 KiB
Go
157 lines
5.5 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package category
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the category type in the database.
|
|
Label = "category"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// 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"
|
|
// EdgeContents holds the string denoting the contents edge name in mutations.
|
|
EdgeContents = "contents"
|
|
// EdgePosts holds the string denoting the posts edge name in mutations.
|
|
EdgePosts = "posts"
|
|
// EdgeDailyItems holds the string denoting the daily_items edge name in mutations.
|
|
EdgeDailyItems = "daily_items"
|
|
// Table holds the table name of the category in the database.
|
|
Table = "categories"
|
|
// ContentsTable is the table that holds the contents relation/edge.
|
|
ContentsTable = "category_contents"
|
|
// ContentsInverseTable is the table name for the CategoryContent entity.
|
|
// It exists in this package in order to avoid circular dependency with the "categorycontent" package.
|
|
ContentsInverseTable = "category_contents"
|
|
// ContentsColumn is the table column denoting the contents relation/edge.
|
|
ContentsColumn = "category_contents"
|
|
// PostsTable is the table that holds the posts relation/edge.
|
|
PostsTable = "posts"
|
|
// PostsInverseTable is the table name for the Post entity.
|
|
// It exists in this package in order to avoid circular dependency with the "post" package.
|
|
PostsInverseTable = "posts"
|
|
// PostsColumn is the table column denoting the posts relation/edge.
|
|
PostsColumn = "category_posts"
|
|
// DailyItemsTable is the table that holds the daily_items relation/edge.
|
|
DailyItemsTable = "dailies"
|
|
// DailyItemsInverseTable is the table name for the Daily entity.
|
|
// It exists in this package in order to avoid circular dependency with the "daily" package.
|
|
DailyItemsInverseTable = "dailies"
|
|
// DailyItemsColumn is the table column denoting the daily_items relation/edge.
|
|
DailyItemsColumn = "category_daily_items"
|
|
)
|
|
|
|
// Columns holds all SQL columns for category fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
}
|
|
|
|
// 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 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
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Category 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()
|
|
}
|
|
|
|
// 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()
|
|
}
|
|
|
|
// 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...)...)
|
|
}
|
|
}
|
|
|
|
// ByPostsCount orders the results by posts count.
|
|
func ByPostsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newPostsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByPosts orders the results by posts terms.
|
|
func ByPosts(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newPostsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByDailyItemsCount orders the results by daily_items count.
|
|
func ByDailyItemsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newDailyItemsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByDailyItems orders the results by daily_items terms.
|
|
func ByDailyItems(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newDailyItemsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
func newContentsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(ContentsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, ContentsTable, ContentsColumn),
|
|
)
|
|
}
|
|
func newPostsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(PostsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, PostsTable, PostsColumn),
|
|
)
|
|
}
|
|
func newDailyItemsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(DailyItemsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, DailyItemsTable, DailyItemsColumn),
|
|
)
|
|
}
|