// Code generated by ent, DO NOT EDIT.

package sourcecontrol

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

const (
	// Label holds the string label denoting the sourcecontrol type in the database.
	Label = "source_control"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldRepoURL holds the string denoting the repo_url field in the database.
	FieldRepoURL = "repo_url"
	// FieldBranch holds the string denoting the branch field in the database.
	FieldBranch = "branch"
	// FieldCommitSha holds the string denoting the commit_sha field in the database.
	FieldCommitSha = "commit_sha"
	// FieldActor holds the string denoting the actor field in the database.
	FieldActor = "actor"
	// FieldRefs holds the string denoting the refs field in the database.
	FieldRefs = "refs"
	// FieldRunID holds the string denoting the run_id field in the database.
	FieldRunID = "run_id"
	// FieldWorkflow holds the string denoting the workflow field in the database.
	FieldWorkflow = "workflow"
	// FieldAction holds the string denoting the action field in the database.
	FieldAction = "action"
	// FieldWorkspace holds the string denoting the workspace field in the database.
	FieldWorkspace = "workspace"
	// FieldEventName holds the string denoting the event_name field in the database.
	FieldEventName = "event_name"
	// FieldJob holds the string denoting the job field in the database.
	FieldJob = "job"
	// FieldRunnerName holds the string denoting the runner_name field in the database.
	FieldRunnerName = "runner_name"
	// FieldRunnerArch holds the string denoting the runner_arch field in the database.
	FieldRunnerArch = "runner_arch"
	// FieldRunnerOs holds the string denoting the runner_os field in the database.
	FieldRunnerOs = "runner_os"
	// EdgeBazelInvocation holds the string denoting the bazel_invocation edge name in mutations.
	EdgeBazelInvocation = "bazel_invocation"
	// Table holds the table name of the sourcecontrol in the database.
	Table = "source_controls"
	// BazelInvocationTable is the table that holds the bazel_invocation relation/edge.
	BazelInvocationTable = "source_controls"
	// BazelInvocationInverseTable is the table name for the BazelInvocation entity.
	// It exists in this package in order to avoid circular dependency with the "bazelinvocation" package.
	BazelInvocationInverseTable = "bazel_invocations"
	// BazelInvocationColumn is the table column denoting the bazel_invocation relation/edge.
	BazelInvocationColumn = "bazel_invocation_source_control"
)

// Columns holds all SQL columns for sourcecontrol fields.
var Columns = []string{
	FieldID,
	FieldRepoURL,
	FieldBranch,
	FieldCommitSha,
	FieldActor,
	FieldRefs,
	FieldRunID,
	FieldWorkflow,
	FieldAction,
	FieldWorkspace,
	FieldEventName,
	FieldJob,
	FieldRunnerName,
	FieldRunnerArch,
	FieldRunnerOs,
}

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

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

// ByRepoURL orders the results by the repo_url field.
func ByRepoURL(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRepoURL, opts...).ToFunc()
}

// ByBranch orders the results by the branch field.
func ByBranch(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBranch, opts...).ToFunc()
}

// ByCommitSha orders the results by the commit_sha field.
func ByCommitSha(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCommitSha, opts...).ToFunc()
}

// ByActor orders the results by the actor field.
func ByActor(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldActor, opts...).ToFunc()
}

// ByRefs orders the results by the refs field.
func ByRefs(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRefs, opts...).ToFunc()
}

// ByRunID orders the results by the run_id field.
func ByRunID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRunID, opts...).ToFunc()
}

// ByWorkflow orders the results by the workflow field.
func ByWorkflow(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWorkflow, opts...).ToFunc()
}

// ByAction orders the results by the action field.
func ByAction(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAction, opts...).ToFunc()
}

// ByWorkspace orders the results by the workspace field.
func ByWorkspace(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWorkspace, opts...).ToFunc()
}

// ByEventName orders the results by the event_name field.
func ByEventName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldEventName, opts...).ToFunc()
}

// ByJob orders the results by the job field.
func ByJob(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldJob, opts...).ToFunc()
}

// ByRunnerName orders the results by the runner_name field.
func ByRunnerName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRunnerName, opts...).ToFunc()
}

// ByRunnerArch orders the results by the runner_arch field.
func ByRunnerArch(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRunnerArch, opts...).ToFunc()
}

// ByRunnerOs orders the results by the runner_os field.
func ByRunnerOs(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRunnerOs, opts...).ToFunc()
}

// ByBazelInvocationField orders the results by bazel_invocation field.
func ByBazelInvocationField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newBazelInvocationStep(), sql.OrderByField(field, opts...))
	}
}
func newBazelInvocationStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(BazelInvocationInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, true, BazelInvocationTable, BazelInvocationColumn),
	)
}
