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

@@ -23,15 +23,18 @@ 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
// Admin holds the value of the admin edge.
Admin *User
} `json:"edges"`
Edges GroupEdges `json:"edges"`
admin_id *int
}
// GroupEdges holds the relations/edges for other nodes in the graph.
type GroupEdges struct {
// Users holds the value of the users edge.
Users []*User
// Admin holds the value of the admin edge.
Admin *User
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Group) scanValues() []interface{} {
return []interface{}{

View File

@@ -23,15 +23,18 @@ type Pet struct {
Name string `json:"name,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the PetQuery when eager-loading is set.
Edges struct {
// Friends holds the value of the friends edge.
Friends []*Pet
// Owner holds the value of the owner edge.
Owner *User
} `json:"edges"`
Edges PetEdges `json:"edges"`
owner_id *int
}
// PetEdges holds the relations/edges for other nodes in the graph.
type PetEdges struct {
// Friends holds the value of the friends edge.
Friends []*Pet
// Owner holds the value of the owner edge.
Owner *User
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Pet) scanValues() []interface{} {
return []interface{}{

View File

@@ -25,16 +25,19 @@ 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 {
// Pets holds the value of the pets edge.
Pets []*Pet
// Friends holds the value of the friends edge.
Friends []*User
// Groups holds the value of the groups edge.
Groups []*Group
// Manage holds the value of the manage edge.
Manage []*Group
} `json:"edges"`
Edges UserEdges `json:"edges"`
}
// UserEdges holds the relations/edges for other nodes in the graph.
type UserEdges struct {
// Pets holds the value of the pets edge.
Pets []*Pet
// Friends holds the value of the friends edge.
Friends []*User
// Groups holds the value of the groups edge.
Groups []*Group
// Manage holds the value of the manage edge.
Manage []*Group
}
// scanValues returns the types for scanning values from sql.Rows.