propertyschema.go•3.6 kB
// Code generated by ent, DO NOT EDIT.
package propertyschema
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/rs/xid"
)
const (
// Label holds the string label denoting the propertyschema type in the database.
Label = "property_schema"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// EdgeNode holds the string denoting the node edge name in mutations.
EdgeNode = "node"
// EdgeFields holds the string denoting the fields edge name in mutations.
EdgeFields = "fields"
// Table holds the table name of the propertyschema in the database.
Table = "property_schemas"
// NodeTable is the table that holds the node relation/edge.
NodeTable = "nodes"
// NodeInverseTable is the table name for the Node entity.
// It exists in this package in order to avoid circular dependency with the "node" package.
NodeInverseTable = "nodes"
// NodeColumn is the table column denoting the node relation/edge.
NodeColumn = "property_schema_id"
// FieldsTable is the table that holds the fields relation/edge.
FieldsTable = "property_schema_fields"
// FieldsInverseTable is the table name for the PropertySchemaField entity.
// It exists in this package in order to avoid circular dependency with the "propertyschemafield" package.
FieldsInverseTable = "property_schema_fields"
// FieldsColumn is the table column denoting the fields relation/edge.
FieldsColumn = "schema_id"
)
// Columns holds all SQL columns for propertyschema fields.
var Columns = []string{
FieldID,
}
// 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 PropertySchema 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()
}
// ByNodeCount orders the results by node count.
func ByNodeCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newNodeStep(), opts...)
}
}
// ByNode orders the results by node terms.
func ByNode(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newNodeStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByFieldsCount orders the results by fields count.
func ByFieldsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newFieldsStep(), opts...)
}
}
// ByFields orders the results by fields terms.
func ByFields(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newFieldsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newNodeStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(NodeInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, NodeTable, NodeColumn),
)
}
func newFieldsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(FieldsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, FieldsTable, FieldsColumn),
)
}