propertyschemafield.go•4.65 kB
// Code generated by ent, DO NOT EDIT.
package propertyschemafield
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/rs/xid"
)
const (
// Label holds the string label denoting the propertyschemafield type in the database.
Label = "property_schema_field"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldType holds the string denoting the type field in the database.
FieldType = "type"
// FieldSort holds the string denoting the sort field in the database.
FieldSort = "sort"
// FieldSchemaID holds the string denoting the schema_id field in the database.
FieldSchemaID = "schema_id"
// EdgeSchema holds the string denoting the schema edge name in mutations.
EdgeSchema = "schema"
// EdgeProperties holds the string denoting the properties edge name in mutations.
EdgeProperties = "properties"
// Table holds the table name of the propertyschemafield in the database.
Table = "property_schema_fields"
// SchemaTable is the table that holds the schema relation/edge.
SchemaTable = "property_schema_fields"
// SchemaInverseTable is the table name for the PropertySchema entity.
// It exists in this package in order to avoid circular dependency with the "propertyschema" package.
SchemaInverseTable = "property_schemas"
// SchemaColumn is the table column denoting the schema relation/edge.
SchemaColumn = "schema_id"
// PropertiesTable is the table that holds the properties relation/edge.
PropertiesTable = "properties"
// PropertiesInverseTable is the table name for the Property entity.
// It exists in this package in order to avoid circular dependency with the "property" package.
PropertiesInverseTable = "properties"
// PropertiesColumn is the table column denoting the properties relation/edge.
PropertiesColumn = "field_id"
)
// Columns holds all SQL columns for propertyschemafield fields.
var Columns = []string{
FieldID,
FieldName,
FieldType,
FieldSort,
FieldSchemaID,
}
// 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 (
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() xid.ID
// IDValidator is a validator for the "id" field. It is called by the builders before save.
IDValidator func(string) error
)
// OrderOption defines the ordering options for the PropertySchemaField 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()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldType, opts...).ToFunc()
}
// BySort orders the results by the sort field.
func BySort(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSort, opts...).ToFunc()
}
// BySchemaID orders the results by the schema_id field.
func BySchemaID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSchemaID, opts...).ToFunc()
}
// BySchemaField orders the results by schema field.
func BySchemaField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newSchemaStep(), sql.OrderByField(field, opts...))
}
}
// ByPropertiesCount orders the results by properties count.
func ByPropertiesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newPropertiesStep(), opts...)
}
}
// ByProperties orders the results by properties terms.
func ByProperties(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newPropertiesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newSchemaStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(SchemaInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, SchemaTable, SchemaColumn),
)
}
func newPropertiesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(PropertiesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, PropertiesTable, PropertiesColumn),
)
}