// Code generated by ent, DO NOT EDIT.

package label

import (
	"time"

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

const (
	// Label holds the string label denoting the label type in the database.
	Label = "label"
	// 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"
	// FieldType holds the string denoting the type field in the database.
	FieldType = "type"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldFrom holds the string denoting the from field in the database.
	FieldFrom = "from"
	// FieldMode holds the string denoting the mode field in the database.
	FieldMode = "mode"
	// FieldConditions holds the string denoting the conditions field in the database.
	FieldConditions = "conditions"
	// FieldOrganizationID holds the string denoting the organization_id field in the database.
	FieldOrganizationID = "organization_id"
	// FieldCtype holds the string denoting the ctype field in the database.
	FieldCtype = "ctype"
	// EdgeLabelRelationships holds the string denoting the label_relationships edge name in mutations.
	EdgeLabelRelationships = "label_relationships"
	// Table holds the table name of the label in the database.
	Table = "label"
	// LabelRelationshipsTable is the table that holds the label_relationships relation/edge.
	LabelRelationshipsTable = "label_relationship"
	// LabelRelationshipsInverseTable is the table name for the LabelRelationship entity.
	// It exists in this package in order to avoid circular dependency with the "labelrelationship" package.
	LabelRelationshipsInverseTable = "label_relationship"
	// LabelRelationshipsColumn is the table column denoting the label_relationships relation/edge.
	LabelRelationshipsColumn = "label_id"
)

// Columns holds all SQL columns for label fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldStatus,
	FieldType,
	FieldName,
	FieldFrom,
	FieldMode,
	FieldConditions,
	FieldOrganizationID,
	FieldCtype,
}

// 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
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus uint8
	// DefaultType holds the default value on creation for the "type" field.
	DefaultType int
	// DefaultName holds the default value on creation for the "name" field.
	DefaultName string
	// DefaultFrom holds the default value on creation for the "from" field.
	DefaultFrom int
	// DefaultMode holds the default value on creation for the "mode" field.
	DefaultMode int
	// DefaultConditions holds the default value on creation for the "conditions" field.
	DefaultConditions string
	// DefaultOrganizationID holds the default value on creation for the "organization_id" field.
	DefaultOrganizationID uint64
	// DefaultCtype holds the default value on creation for the "ctype" field.
	DefaultCtype uint64
)

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

// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldType, opts...).ToFunc()
}

// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldName, opts...).ToFunc()
}

// ByFrom orders the results by the from field.
func ByFrom(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFrom, opts...).ToFunc()
}

// ByMode orders the results by the mode field.
func ByMode(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMode, opts...).ToFunc()
}

// ByConditions orders the results by the conditions field.
func ByConditions(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldConditions, opts...).ToFunc()
}

// ByOrganizationID orders the results by the organization_id field.
func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
}

// ByCtype orders the results by the ctype field.
func ByCtype(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCtype, opts...).ToFunc()
}

// ByLabelRelationshipsCount orders the results by label_relationships count.
func ByLabelRelationshipsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newLabelRelationshipsStep(), opts...)
	}
}

// ByLabelRelationships orders the results by label_relationships terms.
func ByLabelRelationships(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newLabelRelationshipsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newLabelRelationshipsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(LabelRelationshipsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, LabelRelationshipsTable, LabelRelationshipsColumn),
	)
}