entc/gen: add support for referencing fks to existing fields (#1289)

This commit is contained in:
Ariel Mashraki
2021-03-01 22:57:32 +02:00
committed by GitHub
parent 31bee10942
commit 0d0a93b95f
90 changed files with 6936 additions and 327 deletions

View File

@@ -482,7 +482,8 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) {
ids := make([]int, 0, len(nodes))
nodeids := make(map[int][]*Group)
for i := range nodes {
if fk := nodes[i].group_admin; fk != nil {
fk := nodes[i].group_admin
if fk != nil {
ids = append(ids, *fk)
nodeids[*fk] = append(nodeids[*fk], nodes[i])
}