// Code generated by ent, DO NOT EDIT.
package reportdependency
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the reportdependency type in the database.
Label = "report_dependency"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldDependencyPackageID holds the string denoting the dependency_package_id field in the database.
FieldDependencyPackageID = "dependency_package_id"
// FieldDependencyName holds the string denoting the dependency_name field in the database.
FieldDependencyName = "dependency_name"
// FieldDependencyVersion holds the string denoting the dependency_version field in the database.
FieldDependencyVersion = "dependency_version"
// FieldDependencyEcosystem holds the string denoting the dependency_ecosystem field in the database.
FieldDependencyEcosystem = "dependency_ecosystem"
// FieldDependencyType holds the string denoting the dependency_type field in the database.
FieldDependencyType = "dependency_type"
// FieldDepth holds the string denoting the depth field in the database.
FieldDepth = "depth"
// 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"
// EdgePackage holds the string denoting the package edge name in mutations.
EdgePackage = "package"
// Table holds the table name of the reportdependency in the database.
Table = "report_dependencies"
// PackageTable is the table that holds the package relation/edge.
PackageTable = "report_dependencies"
// PackageInverseTable is the table name for the ReportPackage entity.
// It exists in this package in order to avoid circular dependency with the "reportpackage" package.
PackageInverseTable = "report_packages"
// PackageColumn is the table column denoting the package relation/edge.
PackageColumn = "report_package_dependencies"
)
// Columns holds all SQL columns for reportdependency fields.
var Columns = []string{
FieldID,
FieldDependencyPackageID,
FieldDependencyName,
FieldDependencyVersion,
FieldDependencyEcosystem,
FieldDependencyType,
FieldDepth,
FieldCreatedAt,
FieldUpdatedAt,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "report_dependencies"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"report_package_dependencies",
}
// 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
}
var (
// DependencyPackageIDValidator is a validator for the "dependency_package_id" field. It is called by the builders before save.
DependencyPackageIDValidator func(string) error
// DependencyNameValidator is a validator for the "dependency_name" field. It is called by the builders before save.
DependencyNameValidator func(string) error
// DependencyVersionValidator is a validator for the "dependency_version" field. It is called by the builders before save.
DependencyVersionValidator func(string) error
// DependencyEcosystemValidator is a validator for the "dependency_ecosystem" field. It is called by the builders before save.
DependencyEcosystemValidator func(string) error
// DefaultDepth holds the default value on creation for the "depth" field.
DefaultDepth int
)
// OrderOption defines the ordering options for the ReportDependency 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()
}
// ByDependencyPackageID orders the results by the dependency_package_id field.
func ByDependencyPackageID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDependencyPackageID, opts...).ToFunc()
}
// ByDependencyName orders the results by the dependency_name field.
func ByDependencyName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDependencyName, opts...).ToFunc()
}
// ByDependencyVersion orders the results by the dependency_version field.
func ByDependencyVersion(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDependencyVersion, opts...).ToFunc()
}
// ByDependencyEcosystem orders the results by the dependency_ecosystem field.
func ByDependencyEcosystem(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDependencyEcosystem, opts...).ToFunc()
}
// ByDependencyType orders the results by the dependency_type field.
func ByDependencyType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDependencyType, opts...).ToFunc()
}
// ByDepth orders the results by the depth field.
func ByDepth(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDepth, 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()
}
// ByPackageField orders the results by package field.
func ByPackageField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newPackageStep(), sql.OrderByField(field, opts...))
}
}
func newPackageStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(PackageInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, PackageTable, PackageColumn),
)
}