...
1{{- range $interface := .Interfaces }}
2
3func (ec *executionContext) _{{$interface.Name}}(ctx context.Context, sel ast.SelectionSet, obj {{$interface.Type | ref}}) graphql.Marshaler {
4 switch obj := (obj).(type) {
5 case nil:
6 return graphql.Null
7 {{- range $implementor := $interface.Implementors }}
8 case {{$implementor.Type | ref}}:
9 {{- if $implementor.CanBeNil }}
10 if obj == nil {
11 return graphql.Null
12 }
13 {{- end }}
14 return ec._{{$implementor.Name}}(ctx, sel, {{ if $implementor.TakeRef }}&{{ end }}obj)
15 {{- end }}
16 default:
17 panic(fmt.Errorf("unexpected type %T", obj))
18 }
19}
20
21{{- end }}
View as plain text