aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/99designs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/99designs')
-rw-r--r--vendor/github.com/99designs/gqlgen/cmd/ambient.go10
-rw-r--r--vendor/github.com/99designs/gqlgen/cmd/gen.go44
-rw-r--r--vendor/github.com/99designs/gqlgen/cmd/init.go144
-rw-r--r--vendor/github.com/99designs/gqlgen/cmd/root.go44
-rw-r--r--vendor/github.com/99designs/gqlgen/cmd/version.go16
-rw-r--r--vendor/github.com/99designs/gqlgen/plugin/servergen/server.go49
-rw-r--r--vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl20
7 files changed, 0 insertions, 327 deletions
diff --git a/vendor/github.com/99designs/gqlgen/cmd/ambient.go b/vendor/github.com/99designs/gqlgen/cmd/ambient.go
deleted file mode 100644
index 7838fdf1..00000000
--- a/vendor/github.com/99designs/gqlgen/cmd/ambient.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package cmd
-
-import (
- // Import and ignore the ambient imports listed below so dependency managers
- // don't prune unused code for us. Both lists should be kept in sync.
- _ "github.com/99designs/gqlgen/graphql"
- _ "github.com/99designs/gqlgen/graphql/introspection"
- _ "github.com/vektah/gqlparser"
- _ "github.com/vektah/gqlparser/ast"
-)
diff --git a/vendor/github.com/99designs/gqlgen/cmd/gen.go b/vendor/github.com/99designs/gqlgen/cmd/gen.go
deleted file mode 100644
index c69858b4..00000000
--- a/vendor/github.com/99designs/gqlgen/cmd/gen.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package cmd
-
-import (
- "fmt"
- "os"
-
- "github.com/99designs/gqlgen/api"
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/pkg/errors"
- "github.com/urfave/cli"
-)
-
-var genCmd = cli.Command{
- Name: "generate",
- Usage: "generate a graphql server based on schema",
- Flags: []cli.Flag{
- cli.BoolFlag{Name: "verbose, v", Usage: "show logs"},
- cli.StringFlag{Name: "config, c", Usage: "the config filename"},
- },
- Action: func(ctx *cli.Context) {
- var cfg *config.Config
- var err error
- if configFilename := ctx.String("config"); configFilename != "" {
- cfg, err = config.LoadConfig(configFilename)
- if err != nil {
- fmt.Fprintln(os.Stderr, err.Error())
- os.Exit(1)
- }
- } else {
- cfg, err = config.LoadConfigFromDefaultLocations()
- if os.IsNotExist(errors.Cause(err)) {
- cfg = config.DefaultConfig()
- } else if err != nil {
- fmt.Fprintln(os.Stderr, err.Error())
- os.Exit(2)
- }
- }
-
- if err = api.Generate(cfg); err != nil {
- fmt.Fprintln(os.Stderr, err.Error())
- os.Exit(3)
- }
- },
-}
diff --git a/vendor/github.com/99designs/gqlgen/cmd/init.go b/vendor/github.com/99designs/gqlgen/cmd/init.go
deleted file mode 100644
index e07bed97..00000000
--- a/vendor/github.com/99designs/gqlgen/cmd/init.go
+++ /dev/null
@@ -1,144 +0,0 @@
-package cmd
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
- "strings"
-
- "github.com/99designs/gqlgen/api"
- "github.com/99designs/gqlgen/plugin/servergen"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/pkg/errors"
- "github.com/urfave/cli"
- yaml "gopkg.in/yaml.v2"
-)
-
-var configComment = `
-# .gqlgen.yml example
-#
-# Refer to https://gqlgen.com/config/
-# for detailed .gqlgen.yml documentation.
-`
-
-var schemaDefault = `
-# GraphQL schema example
-#
-# https://gqlgen.com/getting-started/
-
-type Todo {
- id: ID!
- text: String!
- done: Boolean!
- user: User!
-}
-
-type User {
- id: ID!
- name: String!
-}
-
-type Query {
- todos: [Todo!]!
-}
-
-input NewTodo {
- text: String!
- userId: String!
-}
-
-type Mutation {
- createTodo(input: NewTodo!): Todo!
-}
-`
-
-var initCmd = cli.Command{
- Name: "init",
- Usage: "create a new gqlgen project",
- Flags: []cli.Flag{
- cli.BoolFlag{Name: "verbose, v", Usage: "show logs"},
- cli.StringFlag{Name: "config, c", Usage: "the config filename"},
- cli.StringFlag{Name: "server", Usage: "where to write the server stub to", Value: "server/server.go"},
- cli.StringFlag{Name: "schema", Usage: "where to write the schema stub to", Value: "schema.graphql"},
- },
- Action: func(ctx *cli.Context) {
- initSchema(ctx.String("schema"))
- config := initConfig(ctx)
-
- GenerateGraphServer(config, ctx.String("server"))
- },
-}
-
-func GenerateGraphServer(cfg *config.Config, serverFilename string) {
- err := api.Generate(cfg, api.AddPlugin(servergen.New(serverFilename)))
- if err != nil {
- fmt.Fprintln(os.Stderr, err.Error())
- }
-
- fmt.Fprintf(os.Stdout, "Exec \"go run ./%s\" to start GraphQL server\n", serverFilename)
-}
-
-func initConfig(ctx *cli.Context) *config.Config {
- var cfg *config.Config
- var err error
- configFilename := ctx.String("config")
- if configFilename != "" {
- cfg, err = config.LoadConfig(configFilename)
- } else {
- cfg, err = config.LoadConfigFromDefaultLocations()
- }
-
- if cfg != nil {
- fmt.Fprintf(os.Stderr, "init failed: a configuration file already exists\n")
- os.Exit(1)
- }
-
- if !os.IsNotExist(errors.Cause(err)) {
- fmt.Fprintln(os.Stderr, err.Error())
- os.Exit(1)
- }
-
- if configFilename == "" {
- configFilename = "gqlgen.yml"
- }
- cfg = config.DefaultConfig()
-
- cfg.Resolver = config.PackageConfig{
- Filename: "resolver.go",
- Type: "Resolver",
- }
-
- var buf bytes.Buffer
- buf.WriteString(strings.TrimSpace(configComment))
- buf.WriteString("\n\n")
- var b []byte
- b, err = yaml.Marshal(cfg)
- if err != nil {
- fmt.Fprintln(os.Stderr, "unable to marshal yaml: "+err.Error())
- os.Exit(1)
- }
- buf.Write(b)
-
- err = ioutil.WriteFile(configFilename, buf.Bytes(), 0644)
- if err != nil {
- fmt.Fprintln(os.Stderr, "unable to write cfg file: "+err.Error())
- os.Exit(1)
- }
-
- return cfg
-}
-
-func initSchema(schemaFilename string) {
- _, err := os.Stat(schemaFilename)
- if !os.IsNotExist(err) {
- return
- }
-
- err = ioutil.WriteFile(schemaFilename, []byte(strings.TrimSpace(schemaDefault)), 0644)
- if err != nil {
- fmt.Fprintln(os.Stderr, "unable to write schema file: "+err.Error())
- os.Exit(1)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/cmd/root.go b/vendor/github.com/99designs/gqlgen/cmd/root.go
deleted file mode 100644
index dc2970ac..00000000
--- a/vendor/github.com/99designs/gqlgen/cmd/root.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package cmd
-
-import (
- "fmt"
- "io/ioutil"
- "log"
- "os"
-
- "github.com/99designs/gqlgen/graphql"
- "github.com/urfave/cli"
-
- // Required since otherwise dep will prune away these unused packages before codegen has a chance to run
- _ "github.com/99designs/gqlgen/handler"
-)
-
-func Execute() {
- app := cli.NewApp()
- app.Name = "gqlgen"
- app.Usage = genCmd.Usage
- app.Description = "This is a library for quickly creating strictly typed graphql servers in golang. See https://gqlgen.com/ for a getting started guide."
- app.HideVersion = true
- app.Flags = genCmd.Flags
- app.Version = graphql.Version
- app.Before = func(context *cli.Context) error {
- if context.Bool("verbose") {
- log.SetFlags(0)
- } else {
- log.SetOutput(ioutil.Discard)
- }
- return nil
- }
-
- app.Action = genCmd.Action
- app.Commands = []cli.Command{
- genCmd,
- initCmd,
- versionCmd,
- }
-
- if err := app.Run(os.Args); err != nil {
- fmt.Fprint(os.Stderr, err.Error())
- os.Exit(1)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/cmd/version.go b/vendor/github.com/99designs/gqlgen/cmd/version.go
deleted file mode 100644
index 8b7442d4..00000000
--- a/vendor/github.com/99designs/gqlgen/cmd/version.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package cmd
-
-import (
- "fmt"
-
- "github.com/99designs/gqlgen/graphql"
- "github.com/urfave/cli"
-)
-
-var versionCmd = cli.Command{
- Name: "version",
- Usage: "print the version string",
- Action: func(ctx *cli.Context) {
- fmt.Println(graphql.Version)
- },
-}
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))
-}