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:
@@ -15,10 +15,8 @@ const (
|
||||
FieldModel = "model"
|
||||
// FieldRegisteredAt holds the string denoting the registered_at field in the database.
|
||||
FieldRegisteredAt = "registered_at"
|
||||
|
||||
// EdgeOwner holds the string denoting the owner edge name in mutations.
|
||||
EdgeOwner = "owner"
|
||||
|
||||
// Table holds the table name of the car in the database.
|
||||
Table = "cars"
|
||||
// OwnerTable is the table the holds the owner relation/edge.
|
||||
@@ -37,7 +35,8 @@ var Columns = []string{
|
||||
FieldRegisteredAt,
|
||||
}
|
||||
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the Car type.
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "cars"
|
||||
// table and are not defined as standalone fields in the schema.
|
||||
var ForeignKeys = []string{
|
||||
"user_cars",
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) {
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_node.user_cars = &nodes[0]
|
||||
_spec.Edges = append(_spec.Edges, edge)
|
||||
}
|
||||
return _node, _spec
|
||||
|
||||
@@ -13,10 +13,8 @@ const (
|
||||
FieldID = "id"
|
||||
// FieldName holds the string denoting the name field in the database.
|
||||
FieldName = "name"
|
||||
|
||||
// EdgeUsers holds the string denoting the users edge name in mutations.
|
||||
EdgeUsers = "users"
|
||||
|
||||
// Table holds the table name of the group in the database.
|
||||
Table = "groups"
|
||||
// UsersTable is the table the holds the users relation/edge. The primary key declared below.
|
||||
|
||||
@@ -15,12 +15,10 @@ const (
|
||||
FieldAge = "age"
|
||||
// FieldName holds the string denoting the name field in the database.
|
||||
FieldName = "name"
|
||||
|
||||
// EdgeCars holds the string denoting the cars edge name in mutations.
|
||||
EdgeCars = "cars"
|
||||
// EdgeGroups holds the string denoting the groups edge name in mutations.
|
||||
EdgeGroups = "groups"
|
||||
|
||||
// Table holds the table name of the user in the database.
|
||||
Table = "users"
|
||||
// CarsTable is the table the holds the cars relation/edge.
|
||||
|
||||
Reference in New Issue
Block a user