github.com/renderinc/gqlgen@v0.7.2/codegen/templates/interface.gotpl (about) 1 {{- $interface := . }} 2 3 func (ec *executionContext) _{{$interface.GQLType}}(ctx context.Context, sel ast.SelectionSet, obj *{{$interface.FullName}}) graphql.Marshaler { 4 switch obj := (*obj).(type) { 5 case nil: 6 return graphql.Null 7 {{- range $implementor := $interface.Implementors }} 8 {{- if $implementor.ValueReceiver }} 9 case {{$implementor.FullName}}: 10 return ec._{{$implementor.GQLType}}(ctx, sel, &obj) 11 {{- end}} 12 case *{{$implementor.FullName}}: 13 return ec._{{$implementor.GQLType}}(ctx, sel, obj) 14 {{- end }} 15 default: 16 panic(fmt.Errorf("unexpected type %T", obj)) 17 } 18 }