github.com/buth/gqlgen@v0.7.2/codegen/templates/resolver.gotpl (about) 1 package {{ .PackageName }} 2 3 import ( 4 %%%IMPORTS%%% 5 6 {{ reserveImport "context" }} 7 {{ reserveImport "fmt" }} 8 {{ reserveImport "io" }} 9 {{ reserveImport "strconv" }} 10 {{ reserveImport "time" }} 11 {{ reserveImport "sync" }} 12 {{ reserveImport "errors" }} 13 {{ reserveImport "bytes" }} 14 15 {{ reserveImport "github.com/99designs/gqlgen/handler" }} 16 {{ reserveImport "github.com/vektah/gqlparser" }} 17 {{ reserveImport "github.com/vektah/gqlparser/ast" }} 18 {{ reserveImport "github.com/99designs/gqlgen/graphql" }} 19 {{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} 20 ) 21 22 type {{.ResolverType}} struct {} 23 24 {{ range $object := .Objects -}} 25 {{- if $object.HasResolvers -}} 26 func (r *{{$.ResolverType}}) {{$object.GQLType}}() {{ $object.ResolverInterface.FullName }} { 27 return &{{lcFirst $object.GQLType}}Resolver{r} 28 } 29 {{ end -}} 30 {{ end }} 31 32 {{ range $object := .Objects -}} 33 {{- if $object.HasResolvers -}} 34 type {{lcFirst $object.GQLType}}Resolver struct { *Resolver } 35 36 {{ range $field := $object.Fields -}} 37 {{- if $field.IsResolver -}} 38 func (r *{{lcFirst $object.GQLType}}Resolver) {{ $field.ShortResolverDeclaration }} { 39 panic("not implemented") 40 } 41 {{ end -}} 42 {{ end -}} 43 {{ end -}} 44 {{ end }}