// Code generated by ent, DO NOT EDIT.

package timingbreakdown

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

const (
	// Label holds the string label denoting the timingbreakdown type in the database.
	Label = "timing_breakdown"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldTime holds the string denoting the time field in the database.
	FieldTime = "time"
	// EdgeExecutionInfo holds the string denoting the execution_info edge name in mutations.
	EdgeExecutionInfo = "execution_info"
	// EdgeChild holds the string denoting the child edge name in mutations.
	EdgeChild = "child"
	// Table holds the table name of the timingbreakdown in the database.
	Table = "timing_breakdowns"
	// ExecutionInfoTable is the table that holds the execution_info relation/edge.
	ExecutionInfoTable = "timing_breakdowns"
	// ExecutionInfoInverseTable is the table name for the ExectionInfo entity.
	// It exists in this package in order to avoid circular dependency with the "exectioninfo" package.
	ExecutionInfoInverseTable = "exection_infos"
	// ExecutionInfoColumn is the table column denoting the execution_info relation/edge.
	ExecutionInfoColumn = "exection_info_timing_breakdown"
	// ChildTable is the table that holds the child relation/edge.
	ChildTable = "timing_childs"
	// ChildInverseTable is the table name for the TimingChild entity.
	// It exists in this package in order to avoid circular dependency with the "timingchild" package.
	ChildInverseTable = "timing_childs"
	// ChildColumn is the table column denoting the child relation/edge.
	ChildColumn = "timing_breakdown_child"
)

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

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

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

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

// ByTime orders the results by the time field.
func ByTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTime, opts...).ToFunc()
}

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

// ByChildCount orders the results by child count.
func ByChildCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newChildStep(), opts...)
	}
}

// ByChild orders the results by child terms.
func ByChild(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newChildStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newExecutionInfoStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ExecutionInfoInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, true, ExecutionInfoTable, ExecutionInfoColumn),
	)
}
func newChildStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ChildInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, ChildTable, ChildColumn),
	)
}
