entc/gen: skip executing sub-query for empty set of edges (#3212)

This commit is contained in:
Ariel Mashraki
2023-01-07 08:54:18 +02:00
committed by GitHub
parent b7da6253b6
commit b88f45aa78
64 changed files with 251 additions and 2 deletions

View File

@@ -178,6 +178,9 @@ func ({{ $receiver }} *{{ $builder }}) sqlAll(ctx context.Context, hooks ...quer
}
nodeids[fk] = append(nodeids[fk], nodes[i])
}
if len(ids) == 0 {
return nil
}
query.Where({{ $e.Type.Package }}.IDIn(ids...))
neighbors, err := query.All(ctx)
if err != nil {