// Code generated by ent, DO NOT EDIT.

package evaluationstat

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

const (
	// Label holds the string label denoting the evaluationstat type in the database.
	Label = "evaluation_stat"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldSkyfunctionName holds the string denoting the skyfunction_name field in the database.
	FieldSkyfunctionName = "skyfunction_name"
	// FieldCount holds the string denoting the count field in the database.
	FieldCount = "count"
	// EdgeBuildGraphMetrics holds the string denoting the build_graph_metrics edge name in mutations.
	EdgeBuildGraphMetrics = "build_graph_metrics"
	// Table holds the table name of the evaluationstat in the database.
	Table = "evaluation_stats"
	// BuildGraphMetricsTable is the table that holds the build_graph_metrics relation/edge.
	BuildGraphMetricsTable = "evaluation_stats"
	// BuildGraphMetricsInverseTable is the table name for the BuildGraphMetrics entity.
	// It exists in this package in order to avoid circular dependency with the "buildgraphmetrics" package.
	BuildGraphMetricsInverseTable = "build_graph_metrics"
	// BuildGraphMetricsColumn is the table column denoting the build_graph_metrics relation/edge.
	BuildGraphMetricsColumn = "build_graph_metrics_evaluated_values"
)

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

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

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

// BySkyfunctionName orders the results by the skyfunction_name field.
func BySkyfunctionName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSkyfunctionName, opts...).ToFunc()
}

// ByCount orders the results by the count field.
func ByCount(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCount, opts...).ToFunc()
}

// ByBuildGraphMetricsField orders the results by build_graph_metrics field.
func ByBuildGraphMetricsField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newBuildGraphMetricsStep(), sql.OrderByField(field, opts...))
	}
}
func newBuildGraphMetricsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(BuildGraphMetricsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, true, BuildGraphMetricsTable, BuildGraphMetricsColumn),
	)
}
