// Code generated by ent, DO NOT EDIT.

package attestation

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 attestation type in the database.
	Label = "attestation"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldCreatedAt holds the string denoting the created_at field in the database.
	FieldCreatedAt = "created_at"
	// FieldBundle holds the string denoting the bundle field in the database.
	FieldBundle = "bundle"
	// FieldWorkflowrunID holds the string denoting the workflowrun_id field in the database.
	FieldWorkflowrunID = "workflowrun_id"
	// EdgeWorkflowrun holds the string denoting the workflowrun edge name in mutations.
	EdgeWorkflowrun = "workflowrun"
	// Table holds the table name of the attestation in the database.
	Table = "attestations"
	// WorkflowrunTable is the table that holds the workflowrun relation/edge.
	WorkflowrunTable = "attestations"
	// WorkflowrunInverseTable is the table name for the WorkflowRun entity.
	// It exists in this package in order to avoid circular dependency with the "workflowrun" package.
	WorkflowrunInverseTable = "workflow_runs"
	// WorkflowrunColumn is the table column denoting the workflowrun relation/edge.
	WorkflowrunColumn = "workflowrun_id"
)

// Columns holds all SQL columns for attestation fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldBundle,
	FieldWorkflowrunID,
}

// 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 (
	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
	DefaultCreatedAt func() time.Time
	// BundleValidator is a validator for the "bundle" field. It is called by the builders before save.
	BundleValidator func([]byte) error
	// DefaultID holds the default value on creation for the "id" field.
	DefaultID func() uuid.UUID
)

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

// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}

// ByWorkflowrunID orders the results by the workflowrun_id field.
func ByWorkflowrunID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWorkflowrunID, opts...).ToFunc()
}

// ByWorkflowrunField orders the results by workflowrun field.
func ByWorkflowrunField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newWorkflowrunStep(), sql.OrderByField(field, opts...))
	}
}
func newWorkflowrunStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(WorkflowrunInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, true, WorkflowrunTable, WorkflowrunColumn),
	)
}
