mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: add edge-field api for schema and codegen (#1213)
This commit is contained in:
@@ -13,10 +13,8 @@ const (
|
||||
FieldID = "id"
|
||||
// FieldName holds the string denoting the name field in the database.
|
||||
FieldName = "name"
|
||||
|
||||
// EdgeOwner holds the string denoting the owner edge name in mutations.
|
||||
EdgeOwner = "owner"
|
||||
|
||||
// Table holds the table name of the pet in the database.
|
||||
Table = "pets"
|
||||
// OwnerTable is the table the holds the owner relation/edge.
|
||||
@@ -34,7 +32,8 @@ var Columns = []string{
|
||||
FieldName,
|
||||
}
|
||||
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the Pet type.
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "pets"
|
||||
// table and are not defined as standalone fields in the schema.
|
||||
var ForeignKeys = []string{
|
||||
"user_pets",
|
||||
}
|
||||
|
||||
@@ -155,6 +155,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) {
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_node.user_pets = &nodes[0]
|
||||
_spec.Edges = append(_spec.Edges, edge)
|
||||
}
|
||||
return _node, _spec
|
||||
|
||||
@@ -15,10 +15,8 @@ const (
|
||||
FieldAge = "age"
|
||||
// FieldName holds the string denoting the name field in the database.
|
||||
FieldName = "name"
|
||||
|
||||
// EdgePets holds the string denoting the pets edge name in mutations.
|
||||
EdgePets = "pets"
|
||||
|
||||
// Table holds the table name of the user in the database.
|
||||
Table = "users"
|
||||
// PetsTable is the table the holds the pets relation/edge.
|
||||
|
||||
Reference in New Issue
Block a user