// Code generated by ent, DO NOT EDIT.

package testfile

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

const (
	// Label holds the string label denoting the testfile type in the database.
	Label = "test_file"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldDigest holds the string denoting the digest field in the database.
	FieldDigest = "digest"
	// FieldFile holds the string denoting the file field in the database.
	FieldFile = "file"
	// FieldLength holds the string denoting the length field in the database.
	FieldLength = "length"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldPrefix holds the string denoting the prefix field in the database.
	FieldPrefix = "prefix"
	// EdgeTestResult holds the string denoting the test_result edge name in mutations.
	EdgeTestResult = "test_result"
	// Table holds the table name of the testfile in the database.
	Table = "test_files"
	// TestResultTable is the table that holds the test_result relation/edge.
	TestResultTable = "test_files"
	// TestResultInverseTable is the table name for the TestResultBES entity.
	// It exists in this package in order to avoid circular dependency with the "testresultbes" package.
	TestResultInverseTable = "test_result_be_ss"
	// TestResultColumn is the table column denoting the test_result relation/edge.
	TestResultColumn = "test_result_bes_test_action_output"
)

// Columns holds all SQL columns for testfile fields.
var Columns = []string{
	FieldID,
	FieldDigest,
	FieldFile,
	FieldLength,
	FieldName,
	FieldPrefix,
}

// ForeignKeys holds the SQL foreign-keys that are owned by the "test_files"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
	"named_set_of_files_files",
	"output_group_inline_files",
	"target_complete_important_output",
	"target_complete_directory_output",
	"test_result_bes_test_action_output",
	"test_summary_passed",
	"test_summary_failed",
}

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

// ByDigest orders the results by the digest field.
func ByDigest(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDigest, opts...).ToFunc()
}

// ByFile orders the results by the file field.
func ByFile(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFile, opts...).ToFunc()
}

// ByLength orders the results by the length field.
func ByLength(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLength, opts...).ToFunc()
}

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

// ByTestResultField orders the results by test_result field.
func ByTestResultField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newTestResultStep(), sql.OrderByField(field, opts...))
	}
}
func newTestResultStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(TestResultInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, TestResultTable, TestResultColumn),
	)
}
