github.com/fortexxx/gqlgen@v0.10.3-0.20191216030626-ca5ea8b21ead/plugin/resolvergen/resolver.gotpl (about)

     1  // THIS CODE IS A STARTING POINT ONLY. IT WILL NOT BE UPDATED WITH SCHEMA CHANGES.
     2  
     3  {{ reserveImport "context"  }}
     4  {{ reserveImport "fmt"  }}
     5  {{ reserveImport "io"  }}
     6  {{ reserveImport "strconv"  }}
     7  {{ reserveImport "time"  }}
     8  {{ reserveImport "sync"  }}
     9  {{ reserveImport "errors"  }}
    10  {{ reserveImport "bytes"  }}
    11  
    12  {{ reserveImport "github.com/vektah/gqlparser" }}
    13  {{ reserveImport "github.com/vektah/gqlparser/ast" }}
    14  {{ reserveImport "github.com/99designs/gqlgen/graphql" }}
    15  {{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }}
    16  
    17  type {{.ResolverType}} struct {}
    18  
    19  {{ range $object := .Objects -}}
    20  	{{- if $object.HasResolvers -}}
    21  		func (r *{{$.ResolverType}}) {{$object.Name}}() {{ $object.ResolverInterface | ref }} {
    22  			return &{{lcFirst $object.Name}}{{ucFirst $.ResolverType}}{r}
    23  		}
    24  	{{ end -}}
    25  {{ end }}
    26  
    27  {{ range $object := .Objects -}}
    28  	{{- if $object.HasResolvers -}}
    29  		type {{lcFirst $object.Name}}{{ucFirst $.ResolverType}} struct { *{{$.ResolverType}} }
    30  
    31  		{{ range $field := $object.Fields -}}
    32  			{{- if $field.IsResolver -}}
    33  			// {{$field.GoFieldName}} {{ $field.ShortResolverDeclaration }}
    34  			func (r *{{lcFirst $object.Name}}{{ucFirst $.ResolverType}}) {{$field.GoFieldName}}{{ $field.ShortResolverDeclaration }} {
    35  				panic("not implemented")
    36  			}
    37  			{{ end -}}
    38  		{{ end -}}
    39  	{{ end -}}
    40  {{ end }}