// Code generated by ent, DO NOT EDIT.

package actiondata

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

const (
	// Label holds the string label denoting the actiondata type in the database.
	Label = "action_data"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldMnemonic holds the string denoting the mnemonic field in the database.
	FieldMnemonic = "mnemonic"
	// FieldActionsExecuted holds the string denoting the actions_executed field in the database.
	FieldActionsExecuted = "actions_executed"
	// FieldActionsCreated holds the string denoting the actions_created field in the database.
	FieldActionsCreated = "actions_created"
	// FieldFirstStartedMs holds the string denoting the first_started_ms field in the database.
	FieldFirstStartedMs = "first_started_ms"
	// FieldLastEndedMs holds the string denoting the last_ended_ms field in the database.
	FieldLastEndedMs = "last_ended_ms"
	// FieldSystemTime holds the string denoting the system_time field in the database.
	FieldSystemTime = "system_time"
	// FieldUserTime holds the string denoting the user_time field in the database.
	FieldUserTime = "user_time"
	// EdgeActionSummary holds the string denoting the action_summary edge name in mutations.
	EdgeActionSummary = "action_summary"
	// Table holds the table name of the actiondata in the database.
	Table = "action_data"
	// ActionSummaryTable is the table that holds the action_summary relation/edge.
	ActionSummaryTable = "action_data"
	// ActionSummaryInverseTable is the table name for the ActionSummary entity.
	// It exists in this package in order to avoid circular dependency with the "actionsummary" package.
	ActionSummaryInverseTable = "action_summaries"
	// ActionSummaryColumn is the table column denoting the action_summary relation/edge.
	ActionSummaryColumn = "action_summary_action_data"
)

// Columns holds all SQL columns for actiondata fields.
var Columns = []string{
	FieldID,
	FieldMnemonic,
	FieldActionsExecuted,
	FieldActionsCreated,
	FieldFirstStartedMs,
	FieldLastEndedMs,
	FieldSystemTime,
	FieldUserTime,
}

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

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

// ByMnemonic orders the results by the mnemonic field.
func ByMnemonic(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMnemonic, opts...).ToFunc()
}

// ByActionsExecuted orders the results by the actions_executed field.
func ByActionsExecuted(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldActionsExecuted, opts...).ToFunc()
}

// ByActionsCreated orders the results by the actions_created field.
func ByActionsCreated(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldActionsCreated, opts...).ToFunc()
}

// ByFirstStartedMs orders the results by the first_started_ms field.
func ByFirstStartedMs(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFirstStartedMs, opts...).ToFunc()
}

// ByLastEndedMs orders the results by the last_ended_ms field.
func ByLastEndedMs(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLastEndedMs, opts...).ToFunc()
}

// BySystemTime orders the results by the system_time field.
func BySystemTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSystemTime, opts...).ToFunc()
}

// ByUserTime orders the results by the user_time field.
func ByUserTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUserTime, opts...).ToFunc()
}

// ByActionSummaryField orders the results by action_summary field.
func ByActionSummaryField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newActionSummaryStep(), sql.OrderByField(field, opts...))
	}
}
func newActionSummaryStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ActionSummaryInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, ActionSummaryTable, ActionSummaryColumn),
	)
}
