entc/gen: fix eager-loading for m2m edges (#335)

Fixed #334
This commit is contained in:
Ariel Mashraki
2020-02-08 22:26:30 +02:00
committed by GitHub
parent c8940e6a5f
commit 48d33fde9d
15 changed files with 19 additions and 19 deletions

File diff suppressed because one or more lines are too long

View File

@@ -326,7 +326,7 @@ func ({{ $receiver }} *{{ $builder }}) sqlQuery() *sql.Selector {
{{- if and (not $field.UserDefined) $field.IsString -}}
strconv.FormatInt({{ $arg }}.Int64, 10)
{{- else if hasPrefix $nulltype "sql" -}}
{{ $field.NullTypeField "eout" -}}
{{ $field.NullTypeField $arg -}}
{{- else -}}
{{ $arg }}
{{- end }}

View File

@@ -331,7 +331,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) {
return fmt.Errorf("unexpected id value for edge-in")
}
outValue := int(eout.Int64)
inValue := int(eout.Int64)
inValue := int(ein.Int64)
node, ok := ids[outValue]
if !ok {
return fmt.Errorf("unexpected node id in edges: %v", outValue)

View File

@@ -392,7 +392,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
return fmt.Errorf("unexpected id value for edge-in")
}
outValue := int(eout.Int64)
inValue := int(eout.Int64)
inValue := int(ein.Int64)
node, ok := ids[outValue]
if !ok {
return fmt.Errorf("unexpected node id in edges: %v", outValue)

View File

@@ -440,7 +440,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
return fmt.Errorf("unexpected id value for edge-in")
}
outValue := uint64(eout.Int64)
inValue := uint64(eout.Int64)
inValue := uint64(ein.Int64)
node, ok := ids[outValue]
if !ok {
return fmt.Errorf("unexpected node id in edges: %v", outValue)
@@ -503,7 +503,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
return fmt.Errorf("unexpected id value for edge-in")
}
outValue := uint64(eout.Int64)
inValue := uint64(eout.Int64)
inValue := uint64(ein.Int64)
node, ok := ids[outValue]
if !ok {
return fmt.Errorf("unexpected node id in edges: %v", outValue)

View File

@@ -408,7 +408,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
return fmt.Errorf("unexpected id value for edge-in")
}
outValue := int(eout.Int64)
inValue := int(eout.Int64)
inValue := int(ein.Int64)
node, ok := ids[outValue]
if !ok {
return fmt.Errorf("unexpected node id in edges: %v", outValue)