// Code generated by ent, DO NOT EDIT. package category import ( "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) 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" // FieldTitle holds the string denoting the title field in the database. FieldTitle = "title" // FieldDescription holds the string denoting the description field in the database. FieldDescription = "description" // EdgePosts holds the string denoting the posts edge name in mutations. EdgePosts = "posts" // Table holds the table name of the category in the database. Table = "categories" // 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" ) // Columns holds all SQL columns for category fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, FieldTitle, FieldDescription, } // 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 // TitleValidator is a validator for the "title" field. It is called by the builders before save. TitleValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // 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() } // ByTitle orders the results by the title field. func ByTitle(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldTitle, opts...).ToFunc() } // ByDescription orders the results by the description field. func ByDescription(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDescription, opts...).ToFunc() } // 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...)...) } } func newPostsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(PostsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, PostsTable, PostsColumn), ) }