// Code generated by ent, DO NOT EDIT.

package dynamicexecutionmetrics

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

const (
	// Label holds the string label denoting the dynamicexecutionmetrics type in the database.
	Label = "dynamic_execution_metrics"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// EdgeMetrics holds the string denoting the metrics edge name in mutations.
	EdgeMetrics = "metrics"
	// EdgeRaceStatistics holds the string denoting the race_statistics edge name in mutations.
	EdgeRaceStatistics = "race_statistics"
	// Table holds the table name of the dynamicexecutionmetrics in the database.
	Table = "dynamic_execution_metrics"
	// MetricsTable is the table that holds the metrics relation/edge.
	MetricsTable = "dynamic_execution_metrics"
	// MetricsInverseTable is the table name for the Metrics entity.
	// It exists in this package in order to avoid circular dependency with the "metrics" package.
	MetricsInverseTable = "metrics"
	// MetricsColumn is the table column denoting the metrics relation/edge.
	MetricsColumn = "metrics_dynamic_execution_metrics"
	// RaceStatisticsTable is the table that holds the race_statistics relation/edge.
	RaceStatisticsTable = "race_statistics"
	// RaceStatisticsInverseTable is the table name for the RaceStatistics entity.
	// It exists in this package in order to avoid circular dependency with the "racestatistics" package.
	RaceStatisticsInverseTable = "race_statistics"
	// RaceStatisticsColumn is the table column denoting the race_statistics relation/edge.
	RaceStatisticsColumn = "dynamic_execution_metrics_race_statistics"
)

// Columns holds all SQL columns for dynamicexecutionmetrics fields.
var Columns = []string{
	FieldID,
}

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

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

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

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

// ByRaceStatisticsCount orders the results by race_statistics count.
func ByRaceStatisticsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newRaceStatisticsStep(), opts...)
	}
}

// ByRaceStatistics orders the results by race_statistics terms.
func ByRaceStatistics(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newRaceStatisticsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newMetricsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(MetricsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, true, MetricsTable, MetricsColumn),
	)
}
func newRaceStatisticsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(RaceStatisticsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, RaceStatisticsTable, RaceStatisticsColumn),
	)
}
