// Code generated by ent, DO NOT EDIT.

package page

import (
	"time"

	"entgo.io/ent"
	"entgo.io/ent/dialect/sql"
)

const (
	// Label holds the string label denoting the page type in the database.
	Label = "page"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
	FieldDeletedAt = "deleted_at"
	// FieldTitle holds the string denoting the title field in the database.
	FieldTitle = "title"
	// FieldPath holds the string denoting the path field in the database.
	FieldPath = "path"
	// FieldContent holds the string denoting the content field in the database.
	FieldContent = "content"
	// FieldMarkdownContent holds the string denoting the markdown_content field in the database.
	FieldMarkdownContent = "markdown_content"
	// FieldDescription holds the string denoting the description field in the database.
	FieldDescription = "description"
	// FieldIsPublished holds the string denoting the is_published field in the database.
	FieldIsPublished = "is_published"
	// FieldShowComment holds the string denoting the show_comment field in the database.
	FieldShowComment = "show_comment"
	// FieldSort holds the string denoting the sort field in the database.
	FieldSort = "sort"
	// 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"
	// Table holds the table name of the page in the database.
	Table = "pages"
)

// Columns holds all SQL columns for page fields.
var Columns = []string{
	FieldID,
	FieldDeletedAt,
	FieldTitle,
	FieldPath,
	FieldContent,
	FieldMarkdownContent,
	FieldDescription,
	FieldIsPublished,
	FieldShowComment,
	FieldSort,
	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
}

// Note that the variables below are initialized by the runtime
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
//	import _ "github.com/anzhiyu-c/anheyu-app/ent/runtime"
var (
	Hooks [1]ent.Hook
	// TitleValidator is a validator for the "title" field. It is called by the builders before save.
	TitleValidator func(string) error
	// PathValidator is a validator for the "path" field. It is called by the builders before save.
	PathValidator func(string) error
	// DefaultMarkdownContent holds the default value on creation for the "markdown_content" field.
	DefaultMarkdownContent string
	// DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
	DescriptionValidator func(string) error
	// DefaultIsPublished holds the default value on creation for the "is_published" field.
	DefaultIsPublished bool
	// DefaultShowComment holds the default value on creation for the "show_comment" field.
	DefaultShowComment bool
	// DefaultSort holds the default value on creation for the "sort" field.
	DefaultSort int
	// 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 Page 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()
}

// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}

// ByTitle orders the results by the title field.
func ByTitle(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTitle, opts...).ToFunc()
}

// ByPath orders the results by the path field.
func ByPath(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPath, opts...).ToFunc()
}

// ByContent orders the results by the content field.
func ByContent(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldContent, opts...).ToFunc()
}

// ByMarkdownContent orders the results by the markdown_content field.
func ByMarkdownContent(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMarkdownContent, opts...).ToFunc()
}

// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDescription, opts...).ToFunc()
}

// ByIsPublished orders the results by the is_published field.
func ByIsPublished(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIsPublished, opts...).ToFunc()
}

// ByShowComment orders the results by the show_comment field.
func ByShowComment(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldShowComment, opts...).ToFunc()
}

// BySort orders the results by the sort field.
func BySort(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSort, 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()
}
