// Code generated by ent, DO NOT EDIT.

package contactfield

import (
	"time"

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

const (
	// Label holds the string label denoting the contactfield type in the database.
	Label = "contact_field"
	// 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"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
	FieldDeletedAt = "deleted_at"
	// FieldContactID holds the string denoting the contact_id field in the database.
	FieldContactID = "contact_id"
	// FieldFormID holds the string denoting the form_id field in the database.
	FieldFormID = "form_id"
	// FieldValue holds the string denoting the value field in the database.
	FieldValue = "value"
	// EdgeFieldContact holds the string denoting the field_contact edge name in mutations.
	EdgeFieldContact = "field_contact"
	// Table holds the table name of the contactfield in the database.
	Table = "contact_field"
	// FieldContactTable is the table that holds the field_contact relation/edge.
	FieldContactTable = "contact_field"
	// FieldContactInverseTable is the table name for the Contact entity.
	// It exists in this package in order to avoid circular dependency with the "contact" package.
	FieldContactInverseTable = "contact"
	// FieldContactColumn is the table column denoting the field_contact relation/edge.
	FieldContactColumn = "contact_id"
)

// Columns holds all SQL columns for contactfield fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldStatus,
	FieldDeletedAt,
	FieldContactID,
	FieldFormID,
	FieldValue,
}

// 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 _ "wechat-api/ent/runtime"
var (
	Hooks        [1]ent.Hook
	Interceptors [1]ent.Interceptor
	// 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
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus uint8
	// DefaultContactID holds the default value on creation for the "contact_id" field.
	DefaultContactID uint64
)

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

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

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

// ByContactID orders the results by the contact_id field.
func ByContactID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldContactID, opts...).ToFunc()
}

// ByFormID orders the results by the form_id field.
func ByFormID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFormID, opts...).ToFunc()
}

// ByFieldContactField orders the results by field_contact field.
func ByFieldContactField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newFieldContactStep(), sql.OrderByField(field, opts...))
	}
}
func newFieldContactStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(FieldContactInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, FieldContactTable, FieldContactColumn),
	)
}
