entc/gen: add type for type edges (#318)

Will be used for adding methods on the struct edges
This commit is contained in:
Ariel Mashraki
2020-01-26 12:39:18 +02:00
committed by GitHub
parent 7c3bcde599
commit bc89ed4e0f
48 changed files with 437 additions and 294 deletions

View File

@@ -26,13 +26,16 @@ type Card struct {
Number string `json:"number,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the CardQuery when eager-loading is set.
Edges struct {
// Owner holds the value of the owner edge.
Owner *User
} `json:"edges"`
Edges CardEdges `json:"edges"`
owner_id *int
}
// CardEdges holds the relations/edges for other nodes in the graph.
type CardEdges struct {
// Owner holds the value of the owner edge.
Owner *User
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Card) scanValues() []interface{} {
return []interface{}{

View File

@@ -25,10 +25,13 @@ 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 {
// Card holds the value of the card edge.
Card *Card
} `json:"edges"`
Edges UserEdges `json:"edges"`
}
// UserEdges holds the relations/edges for other nodes in the graph.
type UserEdges struct {
// Card holds the value of the card edge.
Card *Card
}
// scanValues returns the types for scanning values from sql.Rows.