// Code generated by ent, DO NOT EDIT.

package comment

import (
	"time"

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

const (
	// Label holds the string label denoting the comment type in the database.
	Label = "comment"
	// 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"
	// 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"
	// FieldTargetPath holds the string denoting the target_path field in the database.
	FieldTargetPath = "target_path"
	// FieldTargetTitle holds the string denoting the target_title field in the database.
	FieldTargetTitle = "target_title"
	// FieldUserID holds the string denoting the user_id field in the database.
	FieldUserID = "user_id"
	// FieldParentID holds the string denoting the parent_id field in the database.
	FieldParentID = "parent_id"
	// FieldNickname holds the string denoting the nickname field in the database.
	FieldNickname = "nickname"
	// FieldEmail holds the string denoting the email field in the database.
	FieldEmail = "email"
	// FieldEmailMd5 holds the string denoting the email_md5 field in the database.
	FieldEmailMd5 = "email_md5"
	// FieldWebsite holds the string denoting the website field in the database.
	FieldWebsite = "website"
	// FieldContent holds the string denoting the content field in the database.
	FieldContent = "content"
	// FieldContentHTML holds the string denoting the content_html field in the database.
	FieldContentHTML = "content_html"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldIsAdminComment holds the string denoting the is_admin_comment field in the database.
	FieldIsAdminComment = "is_admin_comment"
	// FieldIsAnonymous holds the string denoting the is_anonymous field in the database.
	FieldIsAnonymous = "is_anonymous"
	// FieldAllowNotification holds the string denoting the allow_notification field in the database.
	FieldAllowNotification = "allow_notification"
	// FieldUserAgent holds the string denoting the user_agent field in the database.
	FieldUserAgent = "user_agent"
	// FieldIPAddress holds the string denoting the ip_address field in the database.
	FieldIPAddress = "ip_address"
	// FieldIPLocation holds the string denoting the ip_location field in the database.
	FieldIPLocation = "ip_location"
	// FieldLikeCount holds the string denoting the like_count field in the database.
	FieldLikeCount = "like_count"
	// FieldPinnedAt holds the string denoting the pinned_at field in the database.
	FieldPinnedAt = "pinned_at"
	// EdgeUser holds the string denoting the user edge name in mutations.
	EdgeUser = "user"
	// EdgeChildren holds the string denoting the children edge name in mutations.
	EdgeChildren = "children"
	// EdgeParent holds the string denoting the parent edge name in mutations.
	EdgeParent = "parent"
	// Table holds the table name of the comment in the database.
	Table = "comments"
	// UserTable is the table that holds the user relation/edge.
	UserTable = "comments"
	// UserInverseTable is the table name for the User entity.
	// It exists in this package in order to avoid circular dependency with the "user" package.
	UserInverseTable = "users"
	// UserColumn is the table column denoting the user relation/edge.
	UserColumn = "user_id"
	// ChildrenTable is the table that holds the children relation/edge.
	ChildrenTable = "comments"
	// ChildrenColumn is the table column denoting the children relation/edge.
	ChildrenColumn = "parent_id"
	// ParentTable is the table that holds the parent relation/edge.
	ParentTable = "comments"
	// ParentColumn is the table column denoting the parent relation/edge.
	ParentColumn = "parent_id"
)

// Columns holds all SQL columns for comment fields.
var Columns = []string{
	FieldID,
	FieldDeletedAt,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldTargetPath,
	FieldTargetTitle,
	FieldUserID,
	FieldParentID,
	FieldNickname,
	FieldEmail,
	FieldEmailMd5,
	FieldWebsite,
	FieldContent,
	FieldContentHTML,
	FieldStatus,
	FieldIsAdminComment,
	FieldIsAnonymous,
	FieldAllowNotification,
	FieldUserAgent,
	FieldIPAddress,
	FieldIPLocation,
	FieldLikeCount,
	FieldPinnedAt,
}

// ForeignKeys holds the SQL foreign-keys that are owned by the "comments"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
	"article_comments",
}

// 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
}

// 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
	// 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
	// TargetPathValidator is a validator for the "target_path" field. It is called by the builders before save.
	TargetPathValidator func(string) error
	// TargetTitleValidator is a validator for the "target_title" field. It is called by the builders before save.
	TargetTitleValidator func(string) error
	// NicknameValidator is a validator for the "nickname" field. It is called by the builders before save.
	NicknameValidator func(string) error
	// EmailValidator is a validator for the "email" field. It is called by the builders before save.
	EmailValidator func(string) error
	// EmailMd5Validator is a validator for the "email_md5" field. It is called by the builders before save.
	EmailMd5Validator func(string) error
	// WebsiteValidator is a validator for the "website" field. It is called by the builders before save.
	WebsiteValidator func(string) error
	// ContentValidator is a validator for the "content" field. It is called by the builders before save.
	ContentValidator func(string) error
	// ContentHTMLValidator is a validator for the "content_html" field. It is called by the builders before save.
	ContentHTMLValidator func(string) error
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus int
	// DefaultIsAdminComment holds the default value on creation for the "is_admin_comment" field.
	DefaultIsAdminComment bool
	// DefaultIsAnonymous holds the default value on creation for the "is_anonymous" field.
	DefaultIsAnonymous bool
	// DefaultAllowNotification holds the default value on creation for the "allow_notification" field.
	DefaultAllowNotification bool
	// UserAgentValidator is a validator for the "user_agent" field. It is called by the builders before save.
	UserAgentValidator func(string) error
	// IPAddressValidator is a validator for the "ip_address" field. It is called by the builders before save.
	IPAddressValidator func(string) error
	// IPLocationValidator is a validator for the "ip_location" field. It is called by the builders before save.
	IPLocationValidator func(string) error
	// DefaultLikeCount holds the default value on creation for the "like_count" field.
	DefaultLikeCount int
	// LikeCountValidator is a validator for the "like_count" field. It is called by the builders before save.
	LikeCountValidator func(int) error
)

// OrderOption defines the ordering options for the Comment 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()
}

// 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()
}

// ByTargetPath orders the results by the target_path field.
func ByTargetPath(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTargetPath, opts...).ToFunc()
}

// ByTargetTitle orders the results by the target_title field.
func ByTargetTitle(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTargetTitle, opts...).ToFunc()
}

// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUserID, opts...).ToFunc()
}

// ByParentID orders the results by the parent_id field.
func ByParentID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldParentID, opts...).ToFunc()
}

// ByNickname orders the results by the nickname field.
func ByNickname(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNickname, opts...).ToFunc()
}

// ByEmail orders the results by the email field.
func ByEmail(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldEmail, opts...).ToFunc()
}

// ByEmailMd5 orders the results by the email_md5 field.
func ByEmailMd5(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldEmailMd5, opts...).ToFunc()
}

// ByWebsite orders the results by the website field.
func ByWebsite(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWebsite, opts...).ToFunc()
}

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

// ByContentHTML orders the results by the content_html field.
func ByContentHTML(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldContentHTML, opts...).ToFunc()
}

// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStatus, opts...).ToFunc()
}

// ByIsAdminComment orders the results by the is_admin_comment field.
func ByIsAdminComment(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIsAdminComment, opts...).ToFunc()
}

// ByIsAnonymous orders the results by the is_anonymous field.
func ByIsAnonymous(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIsAnonymous, opts...).ToFunc()
}

// ByAllowNotification orders the results by the allow_notification field.
func ByAllowNotification(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAllowNotification, opts...).ToFunc()
}

// ByUserAgent orders the results by the user_agent field.
func ByUserAgent(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUserAgent, opts...).ToFunc()
}

// ByIPAddress orders the results by the ip_address field.
func ByIPAddress(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIPAddress, opts...).ToFunc()
}

// ByIPLocation orders the results by the ip_location field.
func ByIPLocation(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIPLocation, opts...).ToFunc()
}

// ByLikeCount orders the results by the like_count field.
func ByLikeCount(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLikeCount, opts...).ToFunc()
}

// ByPinnedAt orders the results by the pinned_at field.
func ByPinnedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPinnedAt, opts...).ToFunc()
}

// ByUserField orders the results by user field.
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
	}
}

// ByChildrenField orders the results by children field.
func ByChildrenField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newChildrenStep(), sql.OrderByField(field, opts...))
	}
}

// ByParentCount orders the results by parent count.
func ByParentCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newParentStep(), opts...)
	}
}

// ByParent orders the results by parent terms.
func ByParent(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newParentStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newUserStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(UserInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
	)
}
func newChildrenStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(Table, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, ChildrenTable, ChildrenColumn),
	)
}
func newParentStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(Table, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, ParentTable, ParentColumn),
	)
}
