mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: add type for type edges (#318)
Will be used for adding methods on the struct edges
This commit is contained in:
@@ -26,13 +26,16 @@ type Car struct {
|
||||
RegisteredAt time.Time `json:"registered_at,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the CarQuery when eager-loading is set.
|
||||
Edges struct {
|
||||
// Owner holds the value of the owner edge.
|
||||
Owner *User
|
||||
} `json:"edges"`
|
||||
Edges CarEdges `json:"edges"`
|
||||
owner_id *int
|
||||
}
|
||||
|
||||
// CarEdges holds the relations/edges for other nodes in the graph.
|
||||
type CarEdges struct {
|
||||
// Owner holds the value of the owner edge.
|
||||
Owner *User
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Car) scanValues() []interface{} {
|
||||
return []interface{}{
|
||||
|
||||
@@ -23,10 +23,13 @@ type Group struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the GroupQuery when eager-loading is set.
|
||||
Edges struct {
|
||||
// Users holds the value of the users edge.
|
||||
Users []*User
|
||||
} `json:"edges"`
|
||||
Edges GroupEdges `json:"edges"`
|
||||
}
|
||||
|
||||
// GroupEdges holds the relations/edges for other nodes in the graph.
|
||||
type GroupEdges struct {
|
||||
// Users holds the value of the users edge.
|
||||
Users []*User
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
|
||||
@@ -25,12 +25,15 @@ type User struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the UserQuery when eager-loading is set.
|
||||
Edges struct {
|
||||
// Cars holds the value of the cars edge.
|
||||
Cars []*Car
|
||||
// Groups holds the value of the groups edge.
|
||||
Groups []*Group
|
||||
} `json:"edges"`
|
||||
Edges UserEdges `json:"edges"`
|
||||
}
|
||||
|
||||
// UserEdges holds the relations/edges for other nodes in the graph.
|
||||
type UserEdges struct {
|
||||
// Cars holds the value of the cars edge.
|
||||
Cars []*Car
|
||||
// Groups holds the value of the groups edge.
|
||||
Groups []*Group
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
|
||||
Reference in New Issue
Block a user