mirror of
https://github.com/ent/ent.git
synced 2026-05-28 09:49:08 +03:00
entc/gen: filter duplicate ids when loading m2m edges
This commit is contained in:
committed by
Ariel Mashraki
parent
6ab0d01ea4
commit
e92dfee33f
@@ -442,7 +442,6 @@ func (tq *TaskQuery) sqlAll(ctx context.Context) ([]*Task, error) {
|
||||
Predicate: func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(task.TeamsPrimaryKey[0], fks...))
|
||||
},
|
||||
|
||||
ScanValues: func() [2]interface{} {
|
||||
return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}}
|
||||
},
|
||||
@@ -461,7 +460,9 @@ func (tq *TaskQuery) sqlAll(ctx context.Context) ([]*Task, error) {
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected node id in edges: %v", outValue)
|
||||
}
|
||||
edgeids = append(edgeids, inValue)
|
||||
if _, ok := edges[inValue]; !ok {
|
||||
edgeids = append(edgeids, inValue)
|
||||
}
|
||||
edges[inValue] = append(edges[inValue], node)
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -434,7 +434,6 @@ func (tq *TeamQuery) sqlAll(ctx context.Context) ([]*Team, error) {
|
||||
Predicate: func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(team.TasksPrimaryKey[1], fks...))
|
||||
},
|
||||
|
||||
ScanValues: func() [2]interface{} {
|
||||
return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}}
|
||||
},
|
||||
@@ -453,7 +452,9 @@ func (tq *TeamQuery) sqlAll(ctx context.Context) ([]*Team, error) {
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected node id in edges: %v", outValue)
|
||||
}
|
||||
edgeids = append(edgeids, inValue)
|
||||
if _, ok := edges[inValue]; !ok {
|
||||
edgeids = append(edgeids, inValue)
|
||||
}
|
||||
edges[inValue] = append(edges[inValue], node)
|
||||
return nil
|
||||
},
|
||||
@@ -498,7 +499,6 @@ func (tq *TeamQuery) sqlAll(ctx context.Context) ([]*Team, error) {
|
||||
Predicate: func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(team.UsersPrimaryKey[1], fks...))
|
||||
},
|
||||
|
||||
ScanValues: func() [2]interface{} {
|
||||
return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}}
|
||||
},
|
||||
@@ -517,7 +517,9 @@ func (tq *TeamQuery) sqlAll(ctx context.Context) ([]*Team, error) {
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected node id in edges: %v", outValue)
|
||||
}
|
||||
edgeids = append(edgeids, inValue)
|
||||
if _, ok := edges[inValue]; !ok {
|
||||
edgeids = append(edgeids, inValue)
|
||||
}
|
||||
edges[inValue] = append(edges[inValue], node)
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -434,7 +434,6 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
|
||||
Predicate: func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(user.TeamsPrimaryKey[0], fks...))
|
||||
},
|
||||
|
||||
ScanValues: func() [2]interface{} {
|
||||
return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}}
|
||||
},
|
||||
@@ -453,7 +452,9 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected node id in edges: %v", outValue)
|
||||
}
|
||||
edgeids = append(edgeids, inValue)
|
||||
if _, ok := edges[inValue]; !ok {
|
||||
edgeids = append(edgeids, inValue)
|
||||
}
|
||||
edges[inValue] = append(edges[inValue], node)
|
||||
return nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user