property.go•4.4 kB
// Code generated by ent, DO NOT EDIT.
package property
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/rs/xid"
)
const (
// Label holds the string label denoting the property type in the database.
Label = "property"
// 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"
// FieldNodeID holds the string denoting the node_id field in the database.
FieldNodeID = "node_id"
// FieldFieldID holds the string denoting the field_id field in the database.
FieldFieldID = "field_id"
// FieldValue holds the string denoting the value field in the database.
FieldValue = "value"
// EdgeNode holds the string denoting the node edge name in mutations.
EdgeNode = "node"
// EdgeSchema holds the string denoting the schema edge name in mutations.
EdgeSchema = "schema"
// Table holds the table name of the property in the database.
Table = "properties"
// NodeTable is the table that holds the node relation/edge.
NodeTable = "properties"
// 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 = "node_id"
// SchemaTable is the table that holds the schema relation/edge.
SchemaTable = "properties"
// SchemaInverseTable is the table name for the PropertySchemaField entity.
// It exists in this package in order to avoid circular dependency with the "propertyschemafield" package.
SchemaInverseTable = "property_schema_fields"
// SchemaColumn is the table column denoting the schema relation/edge.
SchemaColumn = "field_id"
)
// Columns holds all SQL columns for property fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldNodeID,
FieldFieldID,
FieldValue,
}
// 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
// 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 Property 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()
}
// ByNodeID orders the results by the node_id field.
func ByNodeID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNodeID, opts...).ToFunc()
}
// ByFieldID orders the results by the field_id field.
func ByFieldID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFieldID, opts...).ToFunc()
}
// ByValue orders the results by the value field.
func ByValue(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldValue, opts...).ToFunc()
}
// ByNodeField orders the results by node field.
func ByNodeField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newNodeStep(), sql.OrderByField(field, opts...))
}
}
// 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...))
}
}
func newNodeStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(NodeInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, NodeTable, NodeColumn),
)
}
func newSchemaStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(SchemaInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, SchemaTable, SchemaColumn),
)
}