// Code generated by ent, DO NOT EDIT.

package entity

import (
	"time"

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

const (
	// Label holds the string label denoting the entity type in the database.
	Label = "entity"
	// 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"
	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
	FieldUpdatedAt = "updated_at"
	// FieldType holds the string denoting the type field in the database.
	FieldType = "type"
	// FieldSource holds the string denoting the source field in the database.
	FieldSource = "source"
	// FieldSize holds the string denoting the size field in the database.
	FieldSize = "size"
	// FieldUploadSessionID holds the string denoting the upload_session_id field in the database.
	FieldUploadSessionID = "upload_session_id"
	// FieldRecycleOptions holds the string denoting the recycle_options field in the database.
	FieldRecycleOptions = "recycle_options"
	// FieldPolicyID holds the string denoting the policy_id field in the database.
	FieldPolicyID = "policy_id"
	// FieldCreatedBy holds the string denoting the created_by field in the database.
	FieldCreatedBy = "created_by"
	// FieldEtag holds the string denoting the etag field in the database.
	FieldEtag = "etag"
	// FieldMimeType holds the string denoting the mime_type field in the database.
	FieldMimeType = "mime_type"
	// FieldDimension holds the string denoting the dimension field in the database.
	FieldDimension = "dimension"
	// FieldStorageMetadata holds the string denoting the storage_metadata field in the database.
	FieldStorageMetadata = "storage_metadata"
	// EdgeFileVersions holds the string denoting the file_versions edge name in mutations.
	EdgeFileVersions = "file_versions"
	// Table holds the table name of the entity in the database.
	Table = "entities"
	// FileVersionsTable is the table that holds the file_versions relation/edge.
	FileVersionsTable = "file_entities"
	// FileVersionsInverseTable is the table name for the FileEntity entity.
	// It exists in this package in order to avoid circular dependency with the "fileentity" package.
	FileVersionsInverseTable = "file_entities"
	// FileVersionsColumn is the table column denoting the file_versions relation/edge.
	FileVersionsColumn = "entity_id"
)

// Columns holds all SQL columns for entity fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldType,
	FieldSource,
	FieldSize,
	FieldUploadSessionID,
	FieldRecycleOptions,
	FieldPolicyID,
	FieldCreatedBy,
	FieldEtag,
	FieldMimeType,
	FieldDimension,
	FieldStorageMetadata,
}

// 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
	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
	DefaultUpdatedAt func() time.Time
	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
	UpdateDefaultUpdatedAt func() time.Time
	// UploadSessionIDValidator is a validator for the "upload_session_id" field. It is called by the builders before save.
	UploadSessionIDValidator func(string) error
	// EtagValidator is a validator for the "etag" field. It is called by the builders before save.
	EtagValidator func(string) error
	// MimeTypeValidator is a validator for the "mime_type" field. It is called by the builders before save.
	MimeTypeValidator func(string) error
	// DimensionValidator is a validator for the "dimension" field. It is called by the builders before save.
	DimensionValidator func(string) error
)

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

// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}

// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldType, opts...).ToFunc()
}

// BySource orders the results by the source field.
func BySource(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSource, opts...).ToFunc()
}

// BySize orders the results by the size field.
func BySize(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSize, opts...).ToFunc()
}

// ByUploadSessionID orders the results by the upload_session_id field.
func ByUploadSessionID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUploadSessionID, opts...).ToFunc()
}

// ByRecycleOptions orders the results by the recycle_options field.
func ByRecycleOptions(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRecycleOptions, opts...).ToFunc()
}

// ByPolicyID orders the results by the policy_id field.
func ByPolicyID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPolicyID, opts...).ToFunc()
}

// ByCreatedBy orders the results by the created_by field.
func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
}

// ByEtag orders the results by the etag field.
func ByEtag(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldEtag, opts...).ToFunc()
}

// ByMimeType orders the results by the mime_type field.
func ByMimeType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMimeType, opts...).ToFunc()
}

// ByDimension orders the results by the dimension field.
func ByDimension(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDimension, opts...).ToFunc()
}

// ByStorageMetadata orders the results by the storage_metadata field.
func ByStorageMetadata(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStorageMetadata, opts...).ToFunc()
}

// ByFileVersionsCount orders the results by file_versions count.
func ByFileVersionsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newFileVersionsStep(), opts...)
	}
}

// ByFileVersions orders the results by file_versions terms.
func ByFileVersions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newFileVersionsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newFileVersionsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(FileVersionsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, FileVersionsTable, FileVersionsColumn),
	)
}
