// Code generated by ent, DO NOT EDIT.

package actioncachestatistics

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

const (
	// Label holds the string label denoting the actioncachestatistics type in the database.
	Label = "action_cache_statistics"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldSizeInBytes holds the string denoting the size_in_bytes field in the database.
	FieldSizeInBytes = "size_in_bytes"
	// FieldSaveTimeInMs holds the string denoting the save_time_in_ms field in the database.
	FieldSaveTimeInMs = "save_time_in_ms"
	// FieldLoadTimeInMs holds the string denoting the load_time_in_ms field in the database.
	FieldLoadTimeInMs = "load_time_in_ms"
	// FieldHits holds the string denoting the hits field in the database.
	FieldHits = "hits"
	// FieldMisses holds the string denoting the misses field in the database.
	FieldMisses = "misses"
	// EdgeActionSummary holds the string denoting the action_summary edge name in mutations.
	EdgeActionSummary = "action_summary"
	// EdgeMissDetails holds the string denoting the miss_details edge name in mutations.
	EdgeMissDetails = "miss_details"
	// Table holds the table name of the actioncachestatistics in the database.
	Table = "action_cache_statistics"
	// ActionSummaryTable is the table that holds the action_summary relation/edge.
	ActionSummaryTable = "action_cache_statistics"
	// 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_cache_statistics"
	// MissDetailsTable is the table that holds the miss_details relation/edge.
	MissDetailsTable = "miss_details"
	// MissDetailsInverseTable is the table name for the MissDetail entity.
	// It exists in this package in order to avoid circular dependency with the "missdetail" package.
	MissDetailsInverseTable = "miss_details"
	// MissDetailsColumn is the table column denoting the miss_details relation/edge.
	MissDetailsColumn = "action_cache_statistics_miss_details"
)

// Columns holds all SQL columns for actioncachestatistics fields.
var Columns = []string{
	FieldID,
	FieldSizeInBytes,
	FieldSaveTimeInMs,
	FieldLoadTimeInMs,
	FieldHits,
	FieldMisses,
}

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

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

// BySizeInBytes orders the results by the size_in_bytes field.
func BySizeInBytes(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSizeInBytes, opts...).ToFunc()
}

// BySaveTimeInMs orders the results by the save_time_in_ms field.
func BySaveTimeInMs(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSaveTimeInMs, opts...).ToFunc()
}

// ByLoadTimeInMs orders the results by the load_time_in_ms field.
func ByLoadTimeInMs(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLoadTimeInMs, opts...).ToFunc()
}

// ByHits orders the results by the hits field.
func ByHits(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldHits, opts...).ToFunc()
}

// ByMisses orders the results by the misses field.
func ByMisses(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMisses, 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...))
	}
}

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

// ByMissDetails orders the results by miss_details terms.
func ByMissDetails(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newMissDetailsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newActionSummaryStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ActionSummaryInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, true, ActionSummaryTable, ActionSummaryColumn),
	)
}
func newMissDetailsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(MissDetailsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, MissDetailsTable, MissDetailsColumn),
	)
}
