add support for custom scalars -- mainly adding proper import machinery

This commit is contained in:
Ben Kraft
2021-04-08 13:07:31 -07:00
parent e68787ad35
commit b4e8316c6a
31 changed files with 283 additions and 89 deletions
+3 -12
View File
@@ -2,16 +2,7 @@ package {{.Config.Package}}
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
{{if .Config.ContextType -}}
"{{.Config.ContextPackage}}"
{{end}}
{{- if .ImportJSON -}}
"encoding/json"
{{end}}
"github.com/Khan/genqlient/graphql"
)
{{.Imports}}
{{/* TODO: type-assert that your ctx type implements context.Context */}}
@@ -21,10 +12,10 @@ import (
{{.Doc}}
func {{.Name}}(
{{if $.Config.ContextType -}}
ctx {{$.Config.ContextTypeReference}},
ctx {{ref $.Config.ContextType}},
{{end}}
{{- if not $.Config.ClientGetter -}}
client graphql.Client,
client {{ref "github.com/Khan/genqlient/graphql.Client"}},
{{end}}
{{- range .Args -}}
{{.GoName}} {{.GoType}},