// Code generated by ent, DO NOT EDIT.

package filesmetric

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

const (
	// Label holds the string label denoting the filesmetric type in the database.
	Label = "files_metric"
	// 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"
	// FieldCount holds the string denoting the count field in the database.
	FieldCount = "count"
	// EdgeArtifactMetrics holds the string denoting the artifact_metrics edge name in mutations.
	EdgeArtifactMetrics = "artifact_metrics"
	// Table holds the table name of the filesmetric in the database.
	Table = "files_metrics"
	// ArtifactMetricsTable is the table that holds the artifact_metrics relation/edge.
	ArtifactMetricsTable = "files_metrics"
	// ArtifactMetricsInverseTable is the table name for the ArtifactMetrics entity.
	// It exists in this package in order to avoid circular dependency with the "artifactmetrics" package.
	ArtifactMetricsInverseTable = "artifact_metrics"
	// ArtifactMetricsColumn is the table column denoting the artifact_metrics relation/edge.
	ArtifactMetricsColumn = "artifact_metrics_top_level_artifacts"
)

// Columns holds all SQL columns for filesmetric fields.
var Columns = []string{
	FieldID,
	FieldSizeInBytes,
	FieldCount,
}

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

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

// ByCount orders the results by the count field.
func ByCount(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCount, opts...).ToFunc()
}

// ByArtifactMetricsField orders the results by artifact_metrics field.
func ByArtifactMetricsField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newArtifactMetricsStep(), sql.OrderByField(field, opts...))
	}
}
func newArtifactMetricsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ArtifactMetricsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, true, ArtifactMetricsTable, ArtifactMetricsColumn),
	)
}
