diff options
author | Michael Muré <batolettre@gmail.com> | 2019-07-09 13:22:59 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-07-09 13:22:59 +0200 |
commit | 14022953823fc768849b6cc826b05b61a89b7626 (patch) | |
tree | 4d4f70ee46b9cc230d6602cb066c697f8a0a4e8e /vendor/github.com/99designs/gqlgen/plugin | |
parent | a5c42b7c11fc082d47027ba5e0dbdeddcc14e62e (diff) | |
download | git-bug-14022953823fc768849b6cc826b05b61a89b7626.tar.gz |
graphql: don't use the gqlgen command to generate to avoid pulling urfave/cli
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/plugin')
-rw-r--r-- | vendor/github.com/99designs/gqlgen/plugin/servergen/server.go | 49 | ||||
-rw-r--r-- | vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl | 20 |
2 files changed, 0 insertions, 69 deletions
diff --git a/vendor/github.com/99designs/gqlgen/plugin/servergen/server.go b/vendor/github.com/99designs/gqlgen/plugin/servergen/server.go deleted file mode 100644 index 22289c02..00000000 --- a/vendor/github.com/99designs/gqlgen/plugin/servergen/server.go +++ /dev/null @@ -1,49 +0,0 @@ -package servergen - -import ( - "log" - "os" - - "github.com/99designs/gqlgen/codegen" - "github.com/99designs/gqlgen/codegen/templates" - "github.com/99designs/gqlgen/plugin" - "github.com/pkg/errors" -) - -func New(filename string) plugin.Plugin { - return &Plugin{filename} -} - -type Plugin struct { - filename string -} - -var _ plugin.CodeGenerator = &Plugin{} - -func (m *Plugin) Name() string { - return "servergen" -} -func (m *Plugin) GenerateCode(data *codegen.Data) error { - serverBuild := &ServerBuild{ - ExecPackageName: data.Config.Exec.ImportPath(), - ResolverPackageName: data.Config.Resolver.ImportPath(), - } - - if _, err := os.Stat(m.filename); os.IsNotExist(errors.Cause(err)) { - return templates.Render(templates.Options{ - PackageName: "main", - Filename: m.filename, - Data: serverBuild, - }) - } - - log.Printf("Skipped server: %s already exists\n", m.filename) - return nil -} - -type ServerBuild struct { - codegen.Data - - ExecPackageName string - ResolverPackageName string -} diff --git a/vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl b/vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl deleted file mode 100644 index fca71c53..00000000 --- a/vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl +++ /dev/null @@ -1,20 +0,0 @@ -{{ reserveImport "context" }} -{{ reserveImport "log" }} -{{ reserveImport "net/http" }} -{{ reserveImport "os" }} -{{ reserveImport "github.com/99designs/gqlgen/handler" }} - -const defaultPort = "8080" - -func main() { - port := os.Getenv("PORT") - if port == "" { - port = defaultPort - } - - http.Handle("/", handler.Playground("GraphQL playground", "/query")) - http.Handle("/query", handler.GraphQL({{ lookupImport .ExecPackageName }}.NewExecutableSchema({{ lookupImport .ExecPackageName}}.Config{Resolvers: &{{ lookupImport .ResolverPackageName}}.Resolver{}}))) - - log.Printf("connect to http://localhost:%s/ for GraphQL playground", port) - log.Fatal(http.ListenAndServe(":" + port, nil)) -} |