// Code generated by ent, DO NOT EDIT.

package labelrelationship

import (
	"time"

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

const (
	// Label holds the string label denoting the labelrelationship type in the database.
	Label = "label_relationship"
	// 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"
	// FieldLabelID holds the string denoting the label_id field in the database.
	FieldLabelID = "label_id"
	// FieldContactID holds the string denoting the contact_id field in the database.
	FieldContactID = "contact_id"
	// FieldOrganizationID holds the string denoting the organization_id field in the database.
	FieldOrganizationID = "organization_id"
	// EdgeContacts holds the string denoting the contacts edge name in mutations.
	EdgeContacts = "contacts"
	// EdgeLabels holds the string denoting the labels edge name in mutations.
	EdgeLabels = "labels"
	// Table holds the table name of the labelrelationship in the database.
	Table = "label_relationship"
	// ContactsTable is the table that holds the contacts relation/edge.
	ContactsTable = "label_relationship"
	// ContactsInverseTable is the table name for the Contact entity.
	// It exists in this package in order to avoid circular dependency with the "contact" package.
	ContactsInverseTable = "contact"
	// ContactsColumn is the table column denoting the contacts relation/edge.
	ContactsColumn = "contact_id"
	// LabelsTable is the table that holds the labels relation/edge.
	LabelsTable = "label_relationship"
	// LabelsInverseTable is the table name for the Label entity.
	// It exists in this package in order to avoid circular dependency with the "label" package.
	LabelsInverseTable = "label"
	// LabelsColumn is the table column denoting the labels relation/edge.
	LabelsColumn = "label_id"
)

// Columns holds all SQL columns for labelrelationship fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldStatus,
	FieldLabelID,
	FieldContactID,
	FieldOrganizationID,
}

// 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
	// DefaultLabelID holds the default value on creation for the "label_id" field.
	DefaultLabelID uint64
	// DefaultContactID holds the default value on creation for the "contact_id" field.
	DefaultContactID uint64
	// DefaultOrganizationID holds the default value on creation for the "organization_id" field.
	DefaultOrganizationID uint64
)

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

// ByLabelID orders the results by the label_id field.
func ByLabelID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLabelID, opts...).ToFunc()
}

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

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

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

// ByLabelsField orders the results by labels field.
func ByLabelsField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newLabelsStep(), sql.OrderByField(field, opts...))
	}
}
func newContactsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ContactsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, ContactsTable, ContactsColumn),
	)
}
func newLabelsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(LabelsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, LabelsTable, LabelsColumn),
	)
}