mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
* Use vendor code for all go calls * Add missing vendor dependencies * Add travis_retry to yarn install * Fix go test call
44 lines
1.5 KiB
Plaintext
44 lines
1.5 KiB
Plaintext
{{ range $name, $args := .Args }}
|
|
func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
|
var err error
|
|
args := map[string]interface{}{}
|
|
{{- range $i, $arg := . }}
|
|
var arg{{$i}} {{ $arg.TypeReference.GO | ref}}
|
|
if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok {
|
|
{{- if $arg.Directives }}
|
|
getArg0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) }
|
|
|
|
{{- range $i, $directive := $arg.Directives }}
|
|
getArg{{add $i 1}} := func(ctx context.Context) (res interface{}, err error) {
|
|
{{- range $dArg := $directive.Args }}
|
|
{{- if and $dArg.TypeReference.IsPtr ( notNil "Value" $dArg ) }}
|
|
{{ $dArg.VarName }} := {{ $dArg.Value | dump }}
|
|
{{- end }}
|
|
{{- end }}
|
|
n := getArg{{$i}}
|
|
return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs "tmp" "n" }})
|
|
}
|
|
{{- end }}
|
|
|
|
tmp, err = getArg{{$arg.Directives|len}}(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if data, ok := tmp.({{ $arg.TypeReference.GO | ref }}) ; ok {
|
|
arg{{$i}} = data
|
|
} else {
|
|
return nil, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp)
|
|
}
|
|
{{- else }}
|
|
arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
{{- end }}
|
|
}
|
|
args[{{$arg.Name|quote}}] = arg{{$i}}
|
|
{{- end }}
|
|
return args, nil
|
|
}
|
|
{{ end }}
|