aboutsummaryrefslogblamecommitdiffstats
path: root/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl
blob: 81a5807653ca3a4a01843720b533d6e8a3cb36fd (plain) (tree)



















                                                                                                                                               
{{- range $interface := .Interfaces }}

func (ec *executionContext) _{{$interface.Name}}(ctx context.Context, sel ast.SelectionSet, obj *{{$interface.Type | ref}}) graphql.Marshaler {
	switch obj := (*obj).(type) {
	case nil:
		return graphql.Null
	{{- range $implementor := $interface.Implementors }}
		{{- if $implementor.ValueReceiver }}
			case {{$implementor.Type | ref}}:
				return ec._{{$implementor.Name}}(ctx, sel, &obj)
		{{- end}}
		case *{{$implementor.Type | ref}}:
			return ec._{{$implementor.Name}}(ctx, sel, obj)
	{{- end }}
	default:
		panic(fmt.Errorf("unexpected type %T", obj))
	}
}

{{- end }}