// Code generated by ent, DO NOT EDIT.

package gitcommit

import (
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"github.com/google/uuid"
)

const (
	// Label holds the string label denoting the gitcommit type in the database.
	Label = "git_commit"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldCreateTime holds the string denoting the create_time field in the database.
	FieldCreateTime = "create_time"
	// FieldUpdateTime holds the string denoting the update_time field in the database.
	FieldUpdateTime = "update_time"
	// FieldCommitHash holds the string denoting the commit_hash field in the database.
	FieldCommitHash = "commit_hash"
	// FieldBranchName holds the string denoting the branch_name field in the database.
	FieldBranchName = "branch_name"
	// FieldRepoName holds the string denoting the repo_name field in the database.
	FieldRepoName = "repo_name"
	// FieldCommitMessage holds the string denoting the commit_message field in the database.
	FieldCommitMessage = "commit_message"
	// FieldCommitTimestamp holds the string denoting the commit_timestamp field in the database.
	FieldCommitTimestamp = "commit_timestamp"
	// FieldAuthor holds the string denoting the author field in the database.
	FieldAuthor = "author"
	// FieldTimestamp holds the string denoting the timestamp field in the database.
	FieldTimestamp = "timestamp"
	// FieldPrNumber holds the string denoting the pr_number field in the database.
	FieldPrNumber = "pr_number"
	// EdgeResults holds the string denoting the results edge name in mutations.
	EdgeResults = "results"
	// Table holds the table name of the gitcommit in the database.
	Table = "git_commits"
	// ResultsTable is the table that holds the results relation/edge.
	ResultsTable = "ci_workflow_results"
	// ResultsInverseTable is the table name for the CIWorkflowResult entity.
	// It exists in this package in order to avoid circular dependency with the "ciworkflowresult" package.
	ResultsInverseTable = "ci_workflow_results"
	// ResultsColumn is the table column denoting the results relation/edge.
	ResultsColumn = "git_commit_results"
)

// Columns holds all SQL columns for gitcommit fields.
var Columns = []string{
	FieldID,
	FieldCreateTime,
	FieldUpdateTime,
	FieldCommitHash,
	FieldBranchName,
	FieldRepoName,
	FieldCommitMessage,
	FieldCommitTimestamp,
	FieldAuthor,
	FieldTimestamp,
	FieldPrNumber,
}

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

var (
	// DefaultCreateTime holds the default value on creation for the "create_time" field.
	DefaultCreateTime func() time.Time
	// DefaultUpdateTime holds the default value on creation for the "update_time" field.
	DefaultUpdateTime func() time.Time
	// UpdateDefaultUpdateTime holds the default value on update for the "update_time" field.
	UpdateDefaultUpdateTime func() time.Time
	// DefaultID holds the default value on creation for the "id" field.
	DefaultID func() uuid.UUID
)

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

// ByCreateTime orders the results by the create_time field.
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
}

// ByUpdateTime orders the results by the update_time field.
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
}

// ByCommitHash orders the results by the commit_hash field.
func ByCommitHash(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCommitHash, opts...).ToFunc()
}

// ByBranchName orders the results by the branch_name field.
func ByBranchName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBranchName, opts...).ToFunc()
}

// ByRepoName orders the results by the repo_name field.
func ByRepoName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRepoName, opts...).ToFunc()
}

// ByCommitMessage orders the results by the commit_message field.
func ByCommitMessage(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCommitMessage, opts...).ToFunc()
}

// ByCommitTimestamp orders the results by the commit_timestamp field.
func ByCommitTimestamp(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCommitTimestamp, opts...).ToFunc()
}

// ByAuthor orders the results by the author field.
func ByAuthor(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAuthor, opts...).ToFunc()
}

// ByTimestamp orders the results by the timestamp field.
func ByTimestamp(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTimestamp, opts...).ToFunc()
}

// ByPrNumber orders the results by the pr_number field.
func ByPrNumber(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPrNumber, opts...).ToFunc()
}

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

// ByResults orders the results by results terms.
func ByResults(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newResultsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newResultsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ResultsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, ResultsTable, ResultsColumn),
	)
}
