// Code generated by ent, DO NOT EDIT.

package ciworkflowresult

import (
	"registry-backend/ent/schema"
	"time"

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

const (
	// Label holds the string label denoting the ciworkflowresult type in the database.
	Label = "ci_workflow_result"
	// 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"
	// FieldOperatingSystem holds the string denoting the operating_system field in the database.
	FieldOperatingSystem = "operating_system"
	// FieldWorkflowName holds the string denoting the workflow_name field in the database.
	FieldWorkflowName = "workflow_name"
	// FieldRunID holds the string denoting the run_id field in the database.
	FieldRunID = "run_id"
	// FieldJobID holds the string denoting the job_id field in the database.
	FieldJobID = "job_id"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldStartTime holds the string denoting the start_time field in the database.
	FieldStartTime = "start_time"
	// FieldEndTime holds the string denoting the end_time field in the database.
	FieldEndTime = "end_time"
	// FieldPythonVersion holds the string denoting the python_version field in the database.
	FieldPythonVersion = "python_version"
	// FieldPytorchVersion holds the string denoting the pytorch_version field in the database.
	FieldPytorchVersion = "pytorch_version"
	// FieldCudaVersion holds the string denoting the cuda_version field in the database.
	FieldCudaVersion = "cuda_version"
	// FieldComfyRunFlags holds the string denoting the comfy_run_flags field in the database.
	FieldComfyRunFlags = "comfy_run_flags"
	// FieldAvgVram holds the string denoting the avg_vram field in the database.
	FieldAvgVram = "avg_vram"
	// FieldPeakVram holds the string denoting the peak_vram field in the database.
	FieldPeakVram = "peak_vram"
	// FieldJobTriggerUser holds the string denoting the job_trigger_user field in the database.
	FieldJobTriggerUser = "job_trigger_user"
	// FieldMetadata holds the string denoting the metadata field in the database.
	FieldMetadata = "metadata"
	// EdgeGitcommit holds the string denoting the gitcommit edge name in mutations.
	EdgeGitcommit = "gitcommit"
	// EdgeStorageFile holds the string denoting the storage_file edge name in mutations.
	EdgeStorageFile = "storage_file"
	// Table holds the table name of the ciworkflowresult in the database.
	Table = "ci_workflow_results"
	// GitcommitTable is the table that holds the gitcommit relation/edge.
	GitcommitTable = "ci_workflow_results"
	// GitcommitInverseTable is the table name for the GitCommit entity.
	// It exists in this package in order to avoid circular dependency with the "gitcommit" package.
	GitcommitInverseTable = "git_commits"
	// GitcommitColumn is the table column denoting the gitcommit relation/edge.
	GitcommitColumn = "git_commit_results"
	// StorageFileTable is the table that holds the storage_file relation/edge.
	StorageFileTable = "storage_files"
	// StorageFileInverseTable is the table name for the StorageFile entity.
	// It exists in this package in order to avoid circular dependency with the "storagefile" package.
	StorageFileInverseTable = "storage_files"
	// StorageFileColumn is the table column denoting the storage_file relation/edge.
	StorageFileColumn = "ci_workflow_result_storage_file"
)

// Columns holds all SQL columns for ciworkflowresult fields.
var Columns = []string{
	FieldID,
	FieldCreateTime,
	FieldUpdateTime,
	FieldOperatingSystem,
	FieldWorkflowName,
	FieldRunID,
	FieldJobID,
	FieldStatus,
	FieldStartTime,
	FieldEndTime,
	FieldPythonVersion,
	FieldPytorchVersion,
	FieldCudaVersion,
	FieldComfyRunFlags,
	FieldAvgVram,
	FieldPeakVram,
	FieldJobTriggerUser,
	FieldMetadata,
}

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

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

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
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus schema.WorkflowRunStatusType
	// DefaultID holds the default value on creation for the "id" field.
	DefaultID func() uuid.UUID
)

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

// ByOperatingSystem orders the results by the operating_system field.
func ByOperatingSystem(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOperatingSystem, opts...).ToFunc()
}

// ByWorkflowName orders the results by the workflow_name field.
func ByWorkflowName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWorkflowName, opts...).ToFunc()
}

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

// ByJobID orders the results by the job_id field.
func ByJobID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldJobID, opts...).ToFunc()
}

// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStatus, opts...).ToFunc()
}

// ByStartTime orders the results by the start_time field.
func ByStartTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStartTime, opts...).ToFunc()
}

// ByEndTime orders the results by the end_time field.
func ByEndTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldEndTime, opts...).ToFunc()
}

// ByPythonVersion orders the results by the python_version field.
func ByPythonVersion(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPythonVersion, opts...).ToFunc()
}

// ByPytorchVersion orders the results by the pytorch_version field.
func ByPytorchVersion(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPytorchVersion, opts...).ToFunc()
}

// ByCudaVersion orders the results by the cuda_version field.
func ByCudaVersion(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCudaVersion, opts...).ToFunc()
}

// ByComfyRunFlags orders the results by the comfy_run_flags field.
func ByComfyRunFlags(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldComfyRunFlags, opts...).ToFunc()
}

// ByAvgVram orders the results by the avg_vram field.
func ByAvgVram(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAvgVram, opts...).ToFunc()
}

// ByPeakVram orders the results by the peak_vram field.
func ByPeakVram(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPeakVram, opts...).ToFunc()
}

// ByJobTriggerUser orders the results by the job_trigger_user field.
func ByJobTriggerUser(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldJobTriggerUser, opts...).ToFunc()
}

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

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

// ByStorageFile orders the results by storage_file terms.
func ByStorageFile(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newStorageFileStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newGitcommitStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(GitcommitInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, GitcommitTable, GitcommitColumn),
	)
}
func newStorageFileStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(StorageFileInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, StorageFileTable, StorageFileColumn),
	)
}
