From b7f23ea700f64d4f3939e38b6d201fde0d7d023d Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Fri, 3 Aug 2018 10:50:57 +1000 Subject: [PATCH] Rewrite import paths --- .circleci/config.yml | 2 +- README.md | 8 ++++---- appveyor.yml | 2 +- client/client_test.go | 2 +- cmd/gen.go | 2 +- cmd/init.go | 2 +- codegen/codegen.go | 28 +++++++++++++-------------- codegen/enum_build.go | 2 +- codegen/import_build.go | 4 ++-- codegen/import_test.go | 4 ++-- codegen/input_test.go | 2 +- codegen/interface_test.go | 10 +++++----- codegen/templates/data.go | 6 +++--- codegen/templates/generated.gotpl | 2 +- codegen/templates/models.gotpl | 2 +- codegen/templates/resolver.gotpl | 2 +- codegen/type_build.go | 2 +- docs/content/getting-started.md | 14 +++++++------- docs/content/introduction.md | 6 +++--- docs/content/reference/dataloaders.md | 2 +- docs/content/reference/scalars.md | 4 ++-- docs/layouts/_default/single.html | 2 +- docs/layouts/partials/sidebar.html | 2 +- example/chat/.gqlgen.yml | 2 +- example/chat/chat_test.go | 4 ++-- example/chat/generated.go | 6 +++--- example/chat/models_gen.go | 2 +- example/chat/resolvers.go | 2 +- example/chat/server/server.go | 6 +++--- example/config/.gqlgen.yml | 2 +- example/config/generated.go | 6 +++--- example/config/models_gen.go | 2 +- example/config/resolver.go | 2 +- example/config/server/server.go | 4 ++-- example/dataloader/.gqlgen.yml | 4 ++-- example/dataloader/dataloader_test.go | 6 +++--- example/dataloader/dataloaders.go | 6 +++--- example/dataloader/generated.go | 6 +++--- example/dataloader/models_gen.go | 2 +- example/dataloader/resolvers.go | 2 +- example/dataloader/server/server.go | 6 +++--- example/scalars/.gqlgen.yml | 12 ++++++------ example/scalars/generated.go | 8 ++++---- example/scalars/model/generated.go | 2 +- example/scalars/model/model.go | 2 +- example/scalars/resolvers.go | 4 ++-- example/scalars/scalar_test.go | 6 +++--- example/scalars/server/server.go | 4 ++-- example/selection/generated.go | 6 +++--- example/selection/models_gen.go | 2 +- example/selection/selection.go | 4 ++-- example/selection/selection_test.go | 4 ++-- example/selection/server/server.go | 4 ++-- example/starwars/.gqlgen.yml | 10 +++++----- example/starwars/generated.go | 6 +++--- example/starwars/models_gen.go | 2 +- example/starwars/resolvers.go | 2 +- example/starwars/server/server.go | 6 +++--- example/starwars/starwars_test.go | 6 +++--- example/todo/generated.go | 6 +++--- example/todo/models_gen.go | 2 +- example/todo/server/server.go | 4 ++-- example/todo/todo.go | 4 ++-- example/todo/todo_test.go | 6 +++--- handler/graphql.go | 2 +- handler/stub.go | 2 +- handler/websocket.go | 2 +- main.go | 2 +- opentracing/opentracing.go | 2 +- test/config.yaml | 4 ++-- test/generated.go | 8 ++++---- test/models-go/generated.go | 2 +- test/resolvers_test.go | 10 +++++----- 73 files changed, 164 insertions(+), 164 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9aae18f7534..61419caae94 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ jobs: build: docker: - image: golang:1.9 - working_directory: /go/src/github.com/vektah/gqlgen + working_directory: /go/src/github.com/99designs/gqlgen steps: &steps - checkout - run: > diff --git a/README.md b/README.md index a4ccac317b9..50948b88ba1 100644 --- a/README.md +++ b/README.md @@ -10,15 +10,15 @@ See the [docs](https://gqlgen.com/) for a getting started guide. github.com/99designs/gqlgen soon. The next few weeks is going to see some heavy work pushing the new parser and directive support forward. Expect exciting things! -You can follow along on the [project board](https://github.com/vektah/gqlgen/projects/1). +You can follow along on the [project board](https://github.com/99designs/gqlgen/projects/1). ### Feature comparison -| | [gqlgen](https://github.com/vektah/gqlgen) | [gophers](https://github.com/graph-gophers/graphql-go) | [graphql-go](https://github.com/graphql-go/graphql) | [thunder](https://github.com/samsarahq/thunder) | +| | [gqlgen](https://github.com/99designs/gqlgen) | [gophers](https://github.com/graph-gophers/graphql-go) | [graphql-go](https://github.com/graphql-go/graphql) | [thunder](https://github.com/samsarahq/thunder) | | --------: | :-------- | :-------- | :-------- | :-------- | | Kind | schema first | schema first | run time types | struct first | | Boilerplate | less | more | more | some | -| Docs | [docs](https://gqlgen.com) & [examples](https://github.com/vektah/gqlgen/tree/master/example) | [examples](https://github.com/graph-gophers/graphql-go/tree/master/example/starwars) | [examples](https://github.com/graphql-go/graphql/tree/master/examples) | [examples](https://github.com/samsarahq/thunder/tree/master/example)| +| Docs | [docs](https://gqlgen.com) & [examples](https://github.com/99designs/gqlgen/tree/master/example) | [examples](https://github.com/graph-gophers/graphql-go/tree/master/example/starwars) | [examples](https://github.com/graphql-go/graphql/tree/master/examples) | [examples](https://github.com/samsarahq/thunder/tree/master/example)| | Query | :+1: | :+1: | :+1: | :+1: | | Mutation | :+1: | :construction: [pr](https://github.com/graph-gophers/graphql-go/pull/182) | :+1: | :+1: | | Subscription | :+1: | :construction: [pr](https://github.com/graph-gophers/graphql-go/pull/132) | :no_entry: [is](https://github.com/graphql-go/graphql/issues/207) | :+1: | @@ -28,7 +28,7 @@ You can follow along on the [project board](https://github.com/vektah/gqlgen/pro | Interfaces | :+1: | :+1: | :+1: | :no_entry: [is](https://github.com/samsarahq/thunder/issues/78) | | Generated Enums | :+1: | :no_entry: | :no_entry: | :no_entry: | | Generated Inputs | :+1: | :no_entry: | :no_entry: | :no_entry: | -| Stitching gql | :clock1: [is](https://github.com/vektah/gqlgen/issues/5) | :no_entry: | :no_entry: | :no_entry: | +| Stitching gql | :clock1: [is](https://github.com/99designs/gqlgen/issues/5) | :no_entry: | :no_entry: | :no_entry: | | Opentracing | :+1: | :+1: | :no_entry: | :scissors:[pr](https://github.com/samsarahq/thunder/pull/77) | | Hooks for error logging | :+1: | :no_entry: | :no_entry: | :no_entry: | | Dataloading | :+1: | :+1: | :no_entry: | :warning: | diff --git a/appveyor.yml b/appveyor.yml index 5dd4766709d..a07b3b78661 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ version: "{build}" # Source Config skip_branch_with_pr: true -clone_folder: c:\gopath\src\github.com\vektah\gqlgen +clone_folder: c:\gopath\src\github.com\99designs\gqlgen # Build host diff --git a/client/client_test.go b/client/client_test.go index 333446993aa..af58feb140a 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -7,8 +7,8 @@ import ( "net/http/httptest" "testing" + "github.com/99designs/gqlgen/client" "github.com/stretchr/testify/require" - "github.com/vektah/gqlgen/client" ) func TestClient(t *testing.T) { diff --git a/cmd/gen.go b/cmd/gen.go index 0856c6b0d46..6a529ac5b5e 100644 --- a/cmd/gen.go +++ b/cmd/gen.go @@ -5,9 +5,9 @@ import ( "io/ioutil" "os" + "github.com/99designs/gqlgen/codegen" "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/vektah/gqlgen/codegen" "gopkg.in/yaml.v2" ) diff --git a/cmd/init.go b/cmd/init.go index 7cd1e5b508f..72b7c34f3e8 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -7,9 +7,9 @@ import ( "os" "strings" + "github.com/99designs/gqlgen/codegen" "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/vektah/gqlgen/codegen" "gopkg.in/yaml.v2" ) diff --git a/codegen/codegen.go b/codegen/codegen.go index 89d6bfda694..27873400857 100644 --- a/codegen/codegen.go +++ b/codegen/codegen.go @@ -7,8 +7,8 @@ import ( "regexp" "syscall" + "github.com/99designs/gqlgen/codegen/templates" "github.com/pkg/errors" - "github.com/vektah/gqlgen/codegen/templates" "github.com/vektah/gqlparser" "github.com/vektah/gqlparser/ast" "github.com/vektah/gqlparser/gqlerror" @@ -127,19 +127,19 @@ func (cfg *Config) normalize() error { } builtins := TypeMap{ - "__Directive": {Model: "github.com/vektah/gqlgen/graphql/introspection.Directive"}, - "__Type": {Model: "github.com/vektah/gqlgen/graphql/introspection.Type"}, - "__Field": {Model: "github.com/vektah/gqlgen/graphql/introspection.Field"}, - "__EnumValue": {Model: "github.com/vektah/gqlgen/graphql/introspection.EnumValue"}, - "__InputValue": {Model: "github.com/vektah/gqlgen/graphql/introspection.InputValue"}, - "__Schema": {Model: "github.com/vektah/gqlgen/graphql/introspection.Schema"}, - "Int": {Model: "github.com/vektah/gqlgen/graphql.Int"}, - "Float": {Model: "github.com/vektah/gqlgen/graphql.Float"}, - "String": {Model: "github.com/vektah/gqlgen/graphql.String"}, - "Boolean": {Model: "github.com/vektah/gqlgen/graphql.Boolean"}, - "ID": {Model: "github.com/vektah/gqlgen/graphql.ID"}, - "Time": {Model: "github.com/vektah/gqlgen/graphql.Time"}, - "Map": {Model: "github.com/vektah/gqlgen/graphql.Map"}, + "__Directive": {Model: "github.com/99designs/gqlgen/graphql/introspection.Directive"}, + "__Type": {Model: "github.com/99designs/gqlgen/graphql/introspection.Type"}, + "__Field": {Model: "github.com/99designs/gqlgen/graphql/introspection.Field"}, + "__EnumValue": {Model: "github.com/99designs/gqlgen/graphql/introspection.EnumValue"}, + "__InputValue": {Model: "github.com/99designs/gqlgen/graphql/introspection.InputValue"}, + "__Schema": {Model: "github.com/99designs/gqlgen/graphql/introspection.Schema"}, + "Int": {Model: "github.com/99designs/gqlgen/graphql.Int"}, + "Float": {Model: "github.com/99designs/gqlgen/graphql.Float"}, + "String": {Model: "github.com/99designs/gqlgen/graphql.String"}, + "Boolean": {Model: "github.com/99designs/gqlgen/graphql.Boolean"}, + "ID": {Model: "github.com/99designs/gqlgen/graphql.ID"}, + "Time": {Model: "github.com/99designs/gqlgen/graphql.Time"}, + "Map": {Model: "github.com/99designs/gqlgen/graphql.Map"}, } if cfg.Models == nil { diff --git a/codegen/enum_build.go b/codegen/enum_build.go index 6ea1efcad7b..d5e82c24764 100644 --- a/codegen/enum_build.go +++ b/codegen/enum_build.go @@ -4,7 +4,7 @@ import ( "sort" "strings" - "github.com/vektah/gqlgen/codegen/templates" + "github.com/99designs/gqlgen/codegen/templates" "github.com/vektah/gqlparser/ast" ) diff --git a/codegen/import_build.go b/codegen/import_build.go index 7ed7b4e9208..3bad3a26fd2 100644 --- a/codegen/import_build.go +++ b/codegen/import_build.go @@ -22,8 +22,8 @@ var ambientImports = []string{ "github.com/vektah/gqlparser", "github.com/vektah/gqlparser/ast", - "github.com/vektah/gqlgen/graphql", - "github.com/vektah/gqlgen/graphql/introspection", + "github.com/99designs/gqlgen/graphql", + "github.com/99designs/gqlgen/graphql/introspection", } func buildImports(types NamedTypes, destDir string) *Imports { diff --git a/codegen/import_test.go b/codegen/import_test.go index 471aa067978..133049dc55f 100644 --- a/codegen/import_test.go +++ b/codegen/import_test.go @@ -15,7 +15,7 @@ func TestInvalidPackagenames(t *testing.T) { id: Int! } `, TypeMap{ - "InvalidIdentifier": {Model: "github.com/vektah/gqlgen/codegen/tests/invalid-packagename.InvalidIdentifier"}, + "InvalidIdentifier": {Model: "github.com/99designs/gqlgen/codegen/tests/invalid-packagename.InvalidIdentifier"}, }) require.NoError(t, err) @@ -31,7 +31,7 @@ func TestImportCollisions(t *testing.T) { } `, TypeMap{ - "It": {Model: "github.com/vektah/gqlgen/codegen/tests/introspection.It"}, + "It": {Model: "github.com/99designs/gqlgen/codegen/tests/introspection.It"}, }) require.NoError(t, err) diff --git a/codegen/input_test.go b/codegen/input_test.go index a5fecc2bd7c..be2e7da2a6e 100644 --- a/codegen/input_test.go +++ b/codegen/input_test.go @@ -57,7 +57,7 @@ func TestRecursiveInputType(t *testing.T) { self: [RecursiveInputSlice!] } `, TypeMap{ - "RecursiveInputSlice": {Model: "github.com/vektah/gqlgen/codegen/tests.RecursiveInputSlice"}, + "RecursiveInputSlice": {Model: "github.com/99designs/gqlgen/codegen/tests.RecursiveInputSlice"}, }) require.NoError(t, err) diff --git a/codegen/interface_test.go b/codegen/interface_test.go index 83773a156ad..184186f502c 100644 --- a/codegen/interface_test.go +++ b/codegen/interface_test.go @@ -28,10 +28,10 @@ func TestShapes(t *testing.T) { } union ShapeUnion = Circle | Rectangle `, TypeMap{ - "Shape": {Model: "github.com/vektah/gqlgen/codegen/tests.Shape"}, - "ShapeUnion": {Model: "github.com/vektah/gqlgen/codegen/tests.ShapeUnion"}, - "Circle": {Model: "github.com/vektah/gqlgen/codegen/tests.Circle"}, - "Rectangle": {Model: "github.com/vektah/gqlgen/codegen/tests.Rectangle"}, + "Shape": {Model: "github.com/99designs/gqlgen/codegen/tests.Shape"}, + "ShapeUnion": {Model: "github.com/99designs/gqlgen/codegen/tests.ShapeUnion"}, + "Circle": {Model: "github.com/99designs/gqlgen/codegen/tests.Circle"}, + "Rectangle": {Model: "github.com/99designs/gqlgen/codegen/tests.Rectangle"}, }) require.NoError(t, err) @@ -54,7 +54,7 @@ func generate(name string, schema string, typemap ...TypeMap) error { err := Generate(cfg) if err == nil { conf := loader.Config{} - conf.Import("github.com/vektah/gqlgen/codegen/tests/gen/" + name) + conf.Import("github.com/99designs/gqlgen/codegen/tests/gen/" + name) _, err = conf.Load() if err != nil { diff --git a/codegen/templates/data.go b/codegen/templates/data.go index 5dd711aab81..45b5f6d0adb 100644 --- a/codegen/templates/data.go +++ b/codegen/templates/data.go @@ -3,11 +3,11 @@ package templates var data = map[string]string{ "args.gotpl": "\t{{- if . }}args := map[string]interface{}{} {{end}}\n\t{{- range $i, $arg := . }}\n\t\tvar arg{{$i}} {{$arg.Signature }}\n\t\tif tmp, ok := rawArgs[{{$arg.GQLName|quote}}]; ok {\n\t\t\tvar err error\n\t\t\t{{$arg.Unmarshal (print \"arg\" $i) \"tmp\" }}\n\t\t\tif err != nil {\n\t\t\t\tec.Error(ctx, err)\n\t\t\t\t{{- if $arg.Stream }}\n\t\t\t\t\treturn nil\n\t\t\t\t{{- else }}\n\t\t\t\t\treturn graphql.Null\n\t\t\t\t{{- end }}\n\t\t\t}\n\t\t}\n\t\targs[{{$arg.GQLName|quote}}] = arg{{$i}}\n\t{{- end -}}\n", "field.gotpl": "{{ $field := . }}\n{{ $object := $field.Object }}\n\n{{- if $object.Stream }}\n\tfunc (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField) func() graphql.Marshaler {\n\t\t{{- if $field.Args }}\n\t\t\trawArgs := field.ArgumentMap(ec.Variables)\n\t\t\t{{ template \"args.gotpl\" $field.Args }}\n\t\t{{- end }}\n\t\tctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{Field: field})\n\t\tresults, err := ec.resolvers.{{ $field.ShortInvocation }}\n\t\tif err != nil {\n\t\t\tec.Error(ctx, err)\n\t\t\treturn nil\n\t\t}\n\t\treturn func() graphql.Marshaler {\n\t\t\tres, ok := <-results\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tvar out graphql.OrderedMap\n\t\t\tout.Add(field.Alias, func() graphql.Marshaler { {{ $field.WriteJson }} }())\n\t\t\treturn &out\n\t\t}\n\t}\n{{ else }}\n\tfunc (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField, {{if not $object.Root}}obj *{{$object.FullName}}{{end}}) graphql.Marshaler {\n\t\t{{- if $field.Args }}\n\t\t\trawArgs := field.ArgumentMap(ec.Variables)\n\t\t\t{{ template \"args.gotpl\" $field.Args }}\n\t\t{{- end }}\n\n\t\t{{- if $field.IsConcurrent }}\n\t\t\tctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{\n\t\t\t\tObject: {{$object.GQLType|quote}},\n\t\t\t\tArgs: {{if $field.Args }}args{{else}}nil{{end}},\n\t\t\t\tField: field,\n\t\t\t})\n\t\t\treturn graphql.Defer(func() (ret graphql.Marshaler) {\n\t\t\t\tdefer func() {\n\t\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\t\tuserErr := ec.Recover(ctx, r)\n\t\t\t\t\t\tec.Error(ctx, userErr)\n\t\t\t\t\t\tret = graphql.Null\n\t\t\t\t\t}\n\t\t\t\t}()\n\t\t{{ else }}\n\t\t\trctx := graphql.GetResolverContext(ctx)\n\t\t\trctx.Object = {{$object.GQLType|quote}}\n\t\t\trctx.Args = {{if $field.Args }}args{{else}}nil{{end}}\n\t\t\trctx.Field = field\n\t\t\trctx.PushField(field.Alias)\n\t\t\tdefer rctx.Pop()\n\t\t{{- end }}\n\t\t\tresTmp := ec.FieldMiddleware(ctx, func(ctx context.Context) (interface{}, error) {\n\t\t\t\t{{- if $field.IsResolver }}\n\t\t\t\t\treturn ec.resolvers.{{ $field.ShortInvocation }}\n\t\t\t\t{{- else if $field.IsMethod }}\n\t\t\t\t\t{{- if $field.NoErr }}\n\t\t\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }}), nil\n\t\t\t\t\t{{- else }}\n\t\t\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }})\n\t\t\t\t\t{{- end }}\n\t\t\t\t{{- else if $field.IsVariable }}\n\t\t\t\t\treturn {{$field.GoReceiverName}}.{{$field.GoFieldName}}, nil\n\t\t\t\t{{- end }}\n\t\t\t})\n\t\t\tif resTmp == nil {\n\t\t\t\treturn graphql.Null\n\t\t\t}\n\t\t\tres := resTmp.({{$field.Signature}})\n\t\t\t{{ $field.WriteJson }}\n\t\t{{- if $field.IsConcurrent }}\n\t\t\t})\n\t\t{{- end }}\n\t}\n{{ end }}\n", - "generated.gotpl": "// Code generated by github.com/vektah/gqlgen, DO NOT EDIT.\n\npackage {{ .PackageName }}\n\nimport (\n{{- range $import := .Imports }}\n\t{{- $import.Write }}\n{{ end }}\n)\n\n// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.\nfunc NewExecutableSchema(cfg Config) graphql.ExecutableSchema {\n\treturn &executableSchema{\n\t\tresolvers: cfg.Resolvers,\n\t\tdirectives: cfg.Directives,\n\t}\n}\n\ntype Config struct {\n\tResolvers ResolverRoot\n\tDirectives DirectiveRoot\n}\n\ntype ResolverRoot interface {\n{{- range $object := .Objects -}}\n\t{{ if $object.HasResolvers -}}\n\t\t{{$object.GQLType}}() {{$object.GQLType}}Resolver\n\t{{ end }}\n{{- end }}\n}\n\ntype DirectiveRoot struct {\n{{ range $directive := .Directives }}\n\t{{ $directive.Declaration }}\n{{ end }}\n}\n\n{{- range $object := .Objects -}}\n\t{{ if $object.HasResolvers }}\n\t\ttype {{$object.GQLType}}Resolver interface {\n\t\t{{ range $field := $object.Fields -}}\n\t\t\t{{ $field.ShortResolverDeclaration }}\n\t\t{{ end }}\n\t\t}\n\t{{- end }}\n{{- end }}\n\ntype executableSchema struct {\n\tresolvers ResolverRoot\n\tdirectives DirectiveRoot\n}\n\nfunc (e *executableSchema) Schema() *ast.Schema {\n\treturn parsedSchema\n}\n\nfunc (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {\n\t{{- if .QueryRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\tdata := ec._{{.QueryRoot.GQLType}}(ctx, op.SelectionSet)\n\t\t\tvar buf bytes.Buffer\n\t\t\tdata.MarshalGQL(&buf)\n\t\t\treturn buf.Bytes()\n\t\t})\n\n\t\treturn &graphql.Response{\n\t\t\tData: buf,\n\t\t\tErrors: ec.Errors,\n\t\t}\n\t{{- else }}\n\t\treturn graphql.ErrorResponse(ctx, \"queries are not supported\")\n\t{{- end }}\n}\n\nfunc (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {\n\t{{- if .MutationRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\tdata := ec._{{.MutationRoot.GQLType}}(ctx, op.SelectionSet)\n\t\t\tvar buf bytes.Buffer\n\t\t\tdata.MarshalGQL(&buf)\n\t\t\treturn buf.Bytes()\n\t\t})\n\n\t\treturn &graphql.Response{\n\t\t\tData: buf,\n\t\t\tErrors: ec.Errors,\n\t\t}\n\t{{- else }}\n\t\treturn graphql.ErrorResponse(ctx, \"mutations are not supported\")\n\t{{- end }}\n}\n\nfunc (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response {\n\t{{- if .SubscriptionRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tnext := ec._{{.SubscriptionRoot.GQLType}}(ctx, op.SelectionSet)\n\t\tif ec.Errors != nil {\n\t\t\treturn graphql.OneShot(&graphql.Response{Data: []byte(\"null\"), Errors: ec.Errors})\n\t\t}\n\n\t\tvar buf bytes.Buffer\n\t\treturn func() *graphql.Response {\n\t\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\t\tbuf.Reset()\n\t\t\t\tdata := next()\n\n\t\t\t\tif data == nil {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tdata.MarshalGQL(&buf)\n\t\t\t\treturn buf.Bytes()\n\t\t\t})\n\n\t\t\treturn &graphql.Response{\n\t\t\t\tData: buf,\n\t\t\t\tErrors: ec.Errors,\n\t\t\t}\n\t\t}\n\t{{- else }}\n\t\treturn graphql.OneShot(graphql.ErrorResponse(ctx, \"subscriptions are not supported\"))\n\t{{- end }}\n}\n\ntype executionContext struct {\n\t*graphql.RequestContext\n\t*executableSchema\n}\n\n{{- range $object := .Objects }}\n\t{{ template \"object.gotpl\" $object }}\n\n\t{{- range $field := $object.Fields }}\n\t\t{{ template \"field.gotpl\" $field }}\n\t{{ end }}\n{{- end}}\n\n{{- range $interface := .Interfaces }}\n\t{{ template \"interface.gotpl\" $interface }}\n{{- end }}\n\n{{- range $input := .Inputs }}\n\t{{ template \"input.gotpl\" $input }}\n{{- end }}\n\nfunc (ec *executionContext) FieldMiddleware(ctx context.Context, next graphql.Resolver) interface{} {\n\t{{- if .Directives }}\n\trctx := graphql.GetResolverContext(ctx)\n\tfor _, d := range rctx.Field.Definition.Directives {\n\t\tswitch d.Name {\n\t\t{{- range $directive := .Directives }}\n\t\tcase \"{{$directive.Name}}\":\n\t\t\tif ec.directives.{{$directive.Name|ucFirst}} != nil {\n\t\t\t\t{{- if $directive.Args }}\n\t\t\t\t\trawArgs := d.ArgumentMap(ec.Variables)\n\t\t\t\t\t{{ template \"args.gotpl\" $directive.Args }}\n\t\t\t\t{{- end }}\n\t\t\t\tn := next\n\t\t\t\tnext = func(ctx context.Context) (interface{}, error) {\n\t\t\t\t\treturn ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}})\n\t\t\t\t}\n\t\t\t}\n\t\t{{- end }}\n\t\t}\n\t}\n\t{{- end }}\n\tres, err := ec.ResolverMiddleware(ctx, next)\n\tif err != nil {\n\t\tec.Error(ctx, err)\n\t\treturn nil\n\t}\n\treturn res\n}\n\nfunc (ec *executionContext) introspectSchema() *introspection.Schema {\n\treturn introspection.WrapSchema(parsedSchema)\n}\n\nfunc (ec *executionContext) introspectType(name string) *introspection.Type {\n\treturn introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name])\n}\n\nvar parsedSchema = gqlparser.MustLoadSchema(\n\t&ast.Source{Name: {{.SchemaFilename|quote}}, Input: {{.SchemaRaw|rawQuote}}},\n)\n", + "generated.gotpl": "// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.\n\npackage {{ .PackageName }}\n\nimport (\n{{- range $import := .Imports }}\n\t{{- $import.Write }}\n{{ end }}\n)\n\n// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.\nfunc NewExecutableSchema(cfg Config) graphql.ExecutableSchema {\n\treturn &executableSchema{\n\t\tresolvers: cfg.Resolvers,\n\t\tdirectives: cfg.Directives,\n\t}\n}\n\ntype Config struct {\n\tResolvers ResolverRoot\n\tDirectives DirectiveRoot\n}\n\ntype ResolverRoot interface {\n{{- range $object := .Objects -}}\n\t{{ if $object.HasResolvers -}}\n\t\t{{$object.GQLType}}() {{$object.GQLType}}Resolver\n\t{{ end }}\n{{- end }}\n}\n\ntype DirectiveRoot struct {\n{{ range $directive := .Directives }}\n\t{{ $directive.Declaration }}\n{{ end }}\n}\n\n{{- range $object := .Objects -}}\n\t{{ if $object.HasResolvers }}\n\t\ttype {{$object.GQLType}}Resolver interface {\n\t\t{{ range $field := $object.Fields -}}\n\t\t\t{{ $field.ShortResolverDeclaration }}\n\t\t{{ end }}\n\t\t}\n\t{{- end }}\n{{- end }}\n\ntype executableSchema struct {\n\tresolvers ResolverRoot\n\tdirectives DirectiveRoot\n}\n\nfunc (e *executableSchema) Schema() *ast.Schema {\n\treturn parsedSchema\n}\n\nfunc (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {\n\t{{- if .QueryRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\tdata := ec._{{.QueryRoot.GQLType}}(ctx, op.SelectionSet)\n\t\t\tvar buf bytes.Buffer\n\t\t\tdata.MarshalGQL(&buf)\n\t\t\treturn buf.Bytes()\n\t\t})\n\n\t\treturn &graphql.Response{\n\t\t\tData: buf,\n\t\t\tErrors: ec.Errors,\n\t\t}\n\t{{- else }}\n\t\treturn graphql.ErrorResponse(ctx, \"queries are not supported\")\n\t{{- end }}\n}\n\nfunc (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {\n\t{{- if .MutationRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\tdata := ec._{{.MutationRoot.GQLType}}(ctx, op.SelectionSet)\n\t\t\tvar buf bytes.Buffer\n\t\t\tdata.MarshalGQL(&buf)\n\t\t\treturn buf.Bytes()\n\t\t})\n\n\t\treturn &graphql.Response{\n\t\t\tData: buf,\n\t\t\tErrors: ec.Errors,\n\t\t}\n\t{{- else }}\n\t\treturn graphql.ErrorResponse(ctx, \"mutations are not supported\")\n\t{{- end }}\n}\n\nfunc (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response {\n\t{{- if .SubscriptionRoot }}\n\t\tec := executionContext{graphql.GetRequestContext(ctx), e}\n\n\t\tnext := ec._{{.SubscriptionRoot.GQLType}}(ctx, op.SelectionSet)\n\t\tif ec.Errors != nil {\n\t\t\treturn graphql.OneShot(&graphql.Response{Data: []byte(\"null\"), Errors: ec.Errors})\n\t\t}\n\n\t\tvar buf bytes.Buffer\n\t\treturn func() *graphql.Response {\n\t\t\tbuf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {\n\t\t\t\tbuf.Reset()\n\t\t\t\tdata := next()\n\n\t\t\t\tif data == nil {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tdata.MarshalGQL(&buf)\n\t\t\t\treturn buf.Bytes()\n\t\t\t})\n\n\t\t\treturn &graphql.Response{\n\t\t\t\tData: buf,\n\t\t\t\tErrors: ec.Errors,\n\t\t\t}\n\t\t}\n\t{{- else }}\n\t\treturn graphql.OneShot(graphql.ErrorResponse(ctx, \"subscriptions are not supported\"))\n\t{{- end }}\n}\n\ntype executionContext struct {\n\t*graphql.RequestContext\n\t*executableSchema\n}\n\n{{- range $object := .Objects }}\n\t{{ template \"object.gotpl\" $object }}\n\n\t{{- range $field := $object.Fields }}\n\t\t{{ template \"field.gotpl\" $field }}\n\t{{ end }}\n{{- end}}\n\n{{- range $interface := .Interfaces }}\n\t{{ template \"interface.gotpl\" $interface }}\n{{- end }}\n\n{{- range $input := .Inputs }}\n\t{{ template \"input.gotpl\" $input }}\n{{- end }}\n\nfunc (ec *executionContext) FieldMiddleware(ctx context.Context, next graphql.Resolver) interface{} {\n\t{{- if .Directives }}\n\trctx := graphql.GetResolverContext(ctx)\n\tfor _, d := range rctx.Field.Definition.Directives {\n\t\tswitch d.Name {\n\t\t{{- range $directive := .Directives }}\n\t\tcase \"{{$directive.Name}}\":\n\t\t\tif ec.directives.{{$directive.Name|ucFirst}} != nil {\n\t\t\t\t{{- if $directive.Args }}\n\t\t\t\t\trawArgs := d.ArgumentMap(ec.Variables)\n\t\t\t\t\t{{ template \"args.gotpl\" $directive.Args }}\n\t\t\t\t{{- end }}\n\t\t\t\tn := next\n\t\t\t\tnext = func(ctx context.Context) (interface{}, error) {\n\t\t\t\t\treturn ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}})\n\t\t\t\t}\n\t\t\t}\n\t\t{{- end }}\n\t\t}\n\t}\n\t{{- end }}\n\tres, err := ec.ResolverMiddleware(ctx, next)\n\tif err != nil {\n\t\tec.Error(ctx, err)\n\t\treturn nil\n\t}\n\treturn res\n}\n\nfunc (ec *executionContext) introspectSchema() *introspection.Schema {\n\treturn introspection.WrapSchema(parsedSchema)\n}\n\nfunc (ec *executionContext) introspectType(name string) *introspection.Type {\n\treturn introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name])\n}\n\nvar parsedSchema = gqlparser.MustLoadSchema(\n\t&ast.Source{Name: {{.SchemaFilename|quote}}, Input: {{.SchemaRaw|rawQuote}}},\n)\n", "input.gotpl": "\t{{- if .IsMarshaled }}\n\tfunc Unmarshal{{ .GQLType }}(v interface{}) ({{.FullName}}, error) {\n\t\tvar it {{.FullName}}\n\t\tvar asMap = v.(map[string]interface{})\n\t\t{{ range $field := .Fields}}\n\t\t\t{{- if $field.Default}}\n\t\t\t\tif _, present := asMap[{{$field.GQLName|quote}}] ; !present {\n\t\t\t\t\tasMap[{{$field.GQLName|quote}}] = {{ $field.Default | dump }}\n\t\t\t\t}\n\t\t\t{{- end}}\n\t\t{{- end }}\n\n\t\tfor k, v := range asMap {\n\t\t\tswitch k {\n\t\t\t{{- range $field := .Fields }}\n\t\t\tcase {{$field.GQLName|quote}}:\n\t\t\t\tvar err error\n\t\t\t\t{{ $field.Unmarshal (print \"it.\" $field.GoFieldName) \"v\" }}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn it, err\n\t\t\t\t}\n\t\t\t{{- end }}\n\t\t\t}\n\t\t}\n\n\t\treturn it, nil\n\t}\n\t{{- end }}\n", "interface.gotpl": "{{- $interface := . }}\n\nfunc (ec *executionContext) _{{$interface.GQLType}}(ctx context.Context, sel ast.SelectionSet, obj *{{$interface.FullName}}) graphql.Marshaler {\n\tswitch obj := (*obj).(type) {\n\tcase nil:\n\t\treturn graphql.Null\n\t{{- range $implementor := $interface.Implementors }}\n\t\t{{- if $implementor.ValueReceiver }}\n\t\t\tcase {{$implementor.FullName}}:\n\t\t\t\treturn ec._{{$implementor.GQLType}}(ctx, sel, &obj)\n\t\t{{- end}}\n\t\tcase *{{$implementor.FullName}}:\n\t\t\treturn ec._{{$implementor.GQLType}}(ctx, sel, obj)\n\t{{- end }}\n\tdefault:\n\t\tpanic(fmt.Errorf(\"unexpected type %T\", obj))\n\t}\n}\n", - "models.gotpl": "// Code generated by github.com/vektah/gqlgen, DO NOT EDIT.\n\npackage {{ .PackageName }}\n\nimport (\n{{- range $import := .Imports }}\n\t{{- $import.Write }}\n{{ end }}\n)\n\n{{ range $model := .Models }}\n\t{{- if .IsInterface }}\n\t\ttype {{.GoType}} interface {}\n\t{{- else }}\n\t\ttype {{.GoType}} struct {\n\t\t\t{{- range $field := .Fields }}\n\t\t\t\t{{- if $field.GoFieldName }}\n\t\t\t\t\t{{ $field.GoFieldName }} {{$field.Signature}} `json:\"{{$field.GQLName}}\"`\n\t\t\t\t{{- else }}\n\t\t\t\t\t{{ $field.GoFKName }} {{$field.GoFKType}}\n\t\t\t\t{{- end }}\n\t\t\t{{- end }}\n\t\t}\n\t{{- end }}\n{{- end}}\n\n{{ range $enum := .Enums }}\n\ttype {{.GoType}} string\n\tconst (\n\t{{ range $value := .Values -}}\n\t\t{{with .Description}} {{.|prefixLines \"// \"}} {{end}}\n\t\t{{$enum.GoType}}{{ .Name|toCamel }} {{$enum.GoType}} = {{.Name|quote}}\n\t{{- end }}\n\t)\n\n\tfunc (e {{.GoType}}) IsValid() bool {\n\t\tswitch e {\n\t\tcase {{ range $index, $element := .Values}}{{if $index}},{{end}}{{ $enum.GoType }}{{ $element.Name|toCamel }}{{end}}:\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tfunc (e {{.GoType}}) String() string {\n\t\treturn string(e)\n\t}\n\n\tfunc (e *{{.GoType}}) UnmarshalGQL(v interface{}) error {\n\t\tstr, ok := v.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"enums must be strings\")\n\t\t}\n\n\t\t*e = {{.GoType}}(str)\n\t\tif !e.IsValid() {\n\t\t\treturn fmt.Errorf(\"%s is not a valid {{.GQLType}}\", str)\n\t\t}\n\t\treturn nil\n\t}\n\n\tfunc (e {{.GoType}}) MarshalGQL(w io.Writer) {\n\t\tfmt.Fprint(w, strconv.Quote(e.String()))\n\t}\n\n{{- end }}\n", + "models.gotpl": "// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.\n\npackage {{ .PackageName }}\n\nimport (\n{{- range $import := .Imports }}\n\t{{- $import.Write }}\n{{ end }}\n)\n\n{{ range $model := .Models }}\n\t{{- if .IsInterface }}\n\t\ttype {{.GoType}} interface {}\n\t{{- else }}\n\t\ttype {{.GoType}} struct {\n\t\t\t{{- range $field := .Fields }}\n\t\t\t\t{{- if $field.GoFieldName }}\n\t\t\t\t\t{{ $field.GoFieldName }} {{$field.Signature}} `json:\"{{$field.GQLName}}\"`\n\t\t\t\t{{- else }}\n\t\t\t\t\t{{ $field.GoFKName }} {{$field.GoFKType}}\n\t\t\t\t{{- end }}\n\t\t\t{{- end }}\n\t\t}\n\t{{- end }}\n{{- end}}\n\n{{ range $enum := .Enums }}\n\ttype {{.GoType}} string\n\tconst (\n\t{{ range $value := .Values -}}\n\t\t{{with .Description}} {{.|prefixLines \"// \"}} {{end}}\n\t\t{{$enum.GoType}}{{ .Name|toCamel }} {{$enum.GoType}} = {{.Name|quote}}\n\t{{- end }}\n\t)\n\n\tfunc (e {{.GoType}}) IsValid() bool {\n\t\tswitch e {\n\t\tcase {{ range $index, $element := .Values}}{{if $index}},{{end}}{{ $enum.GoType }}{{ $element.Name|toCamel }}{{end}}:\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tfunc (e {{.GoType}}) String() string {\n\t\treturn string(e)\n\t}\n\n\tfunc (e *{{.GoType}}) UnmarshalGQL(v interface{}) error {\n\t\tstr, ok := v.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"enums must be strings\")\n\t\t}\n\n\t\t*e = {{.GoType}}(str)\n\t\tif !e.IsValid() {\n\t\t\treturn fmt.Errorf(\"%s is not a valid {{.GQLType}}\", str)\n\t\t}\n\t\treturn nil\n\t}\n\n\tfunc (e {{.GoType}}) MarshalGQL(w io.Writer) {\n\t\tfmt.Fprint(w, strconv.Quote(e.String()))\n\t}\n\n{{- end }}\n", "object.gotpl": "{{ $object := . }}\n\nvar {{ $object.GQLType|lcFirst}}Implementors = {{$object.Implementors}}\n\n// nolint: gocyclo, errcheck, gas, goconst\n{{- if .Stream }}\nfunc (ec *executionContext) _{{$object.GQLType}}(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, {{$object.GQLType|lcFirst}}Implementors)\n\tctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{\n\t\tObject: {{$object.GQLType|quote}},\n\t})\n\tif len(fields) != 1 {\n\t\tec.Errorf(ctx, \"must subscribe to exactly one stream\")\n\t\treturn nil\n\t}\n\n\tswitch fields[0].Name {\n\t{{- range $field := $object.Fields }}\n\tcase \"{{$field.GQLName}}\":\n\t\treturn ec._{{$object.GQLType}}_{{$field.GQLName}}(ctx, fields[0])\n\t{{- end }}\n\tdefault:\n\t\tpanic(\"unknown field \" + strconv.Quote(fields[0].Name))\n\t}\n}\n{{- else }}\nfunc (ec *executionContext) _{{$object.GQLType}}(ctx context.Context, sel ast.SelectionSet{{if not $object.Root}}, obj *{{$object.FullName}} {{end}}) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, {{$object.GQLType|lcFirst}}Implementors)\n\t{{if $object.Root}}\n\t\tctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{\n\t\t\tObject: {{$object.GQLType|quote}},\n\t\t})\n\t{{end}}\n\tout := graphql.NewOrderedMap(len(fields))\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString({{$object.GQLType|quote}})\n\t\t{{- range $field := $object.Fields }}\n\t\tcase \"{{$field.GQLName}}\":\n\t\t\tout.Values[i] = ec._{{$object.GQLType}}_{{$field.GQLName}}(ctx, field{{if not $object.Root}}, obj{{end}})\n\t\t{{- end }}\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\treturn out\n}\n{{- end }}\n", - "resolver.gotpl": "//go:generate gorunpkg github.com/vektah/gqlgen\n\npackage {{ .PackageName }}\n\nimport (\n{{- range $import := .Imports }}\n\t{{- $import.Write }}\n{{ end }}\n)\n\ntype {{.ResolverType}} struct {}\n\n{{ range $object := .Objects -}}\n\t{{- if $object.HasResolvers -}}\n\t\tfunc (r *{{$.ResolverType}}) {{$object.GQLType}}() {{ $object.ResolverInterface.FullName }} {\n\t\t\treturn &{{lcFirst $object.GQLType}}Resolver{r}\n\t\t}\n\t{{ end -}}\n{{ end }}\n\n{{ range $object := .Objects -}}\n\t{{- if $object.HasResolvers -}}\n\t\ttype {{lcFirst $object.GQLType}}Resolver struct { *Resolver }\n\n\t\t{{ range $field := $object.Fields -}}\n\t\t\t{{- if $field.IsResolver -}}\n\t\t\tfunc (r *{{lcFirst $object.GQLType}}Resolver) {{ $field.ShortResolverDeclaration }} {\n\t\t\t\tpanic(\"not implemented\")\n\t\t\t}\n\t\t\t{{ end -}}\n\t\t{{ end -}}\n\t{{ end -}}\n{{ end }}\n", + "resolver.gotpl": "//go:generate gorunpkg github.com/99designs/gqlgen\n\npackage {{ .PackageName }}\n\nimport (\n{{- range $import := .Imports }}\n\t{{- $import.Write }}\n{{ end }}\n)\n\ntype {{.ResolverType}} struct {}\n\n{{ range $object := .Objects -}}\n\t{{- if $object.HasResolvers -}}\n\t\tfunc (r *{{$.ResolverType}}) {{$object.GQLType}}() {{ $object.ResolverInterface.FullName }} {\n\t\t\treturn &{{lcFirst $object.GQLType}}Resolver{r}\n\t\t}\n\t{{ end -}}\n{{ end }}\n\n{{ range $object := .Objects -}}\n\t{{- if $object.HasResolvers -}}\n\t\ttype {{lcFirst $object.GQLType}}Resolver struct { *Resolver }\n\n\t\t{{ range $field := $object.Fields -}}\n\t\t\t{{- if $field.IsResolver -}}\n\t\t\tfunc (r *{{lcFirst $object.GQLType}}Resolver) {{ $field.ShortResolverDeclaration }} {\n\t\t\t\tpanic(\"not implemented\")\n\t\t\t}\n\t\t\t{{ end -}}\n\t\t{{ end -}}\n\t{{ end -}}\n{{ end }}\n", "server.gotpl": "package main\n\nimport (\n{{- range $import := .Imports }}\n\t{{- $import.Write }}\n{{ end }}\n)\n\nconst defaultPort = \"8080\"\n\nfunc main() {\n\tport := os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = defaultPort\n\t}\n\n\thttp.Handle(\"/\", handler.Playground(\"GraphQL playground\", \"/query\"))\n\thttp.Handle(\"/query\", handler.GraphQL({{.ExecPackageName}}.NewExecutableSchema({{.ExecPackageName}}.Config{Resolvers: &{{.ResolverPackageName}}.Resolver{}})))\n\n\tlog.Printf(\"connect to http://localhost:%s/ for GraphQL playground\", port)\n\tlog.Fatal(http.ListenAndServe(\":\" + port, nil))\n}\n", } diff --git a/codegen/templates/generated.gotpl b/codegen/templates/generated.gotpl index fd2364c4f8f..309185dd8fe 100644 --- a/codegen/templates/generated.gotpl +++ b/codegen/templates/generated.gotpl @@ -1,4 +1,4 @@ -// Code generated by github.com/vektah/gqlgen, DO NOT EDIT. +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. package {{ .PackageName }} diff --git a/codegen/templates/models.gotpl b/codegen/templates/models.gotpl index ed9523059a6..c9599333565 100644 --- a/codegen/templates/models.gotpl +++ b/codegen/templates/models.gotpl @@ -1,4 +1,4 @@ -// Code generated by github.com/vektah/gqlgen, DO NOT EDIT. +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. package {{ .PackageName }} diff --git a/codegen/templates/resolver.gotpl b/codegen/templates/resolver.gotpl index b14b308e593..dd8acf24d86 100644 --- a/codegen/templates/resolver.gotpl +++ b/codegen/templates/resolver.gotpl @@ -1,4 +1,4 @@ -//go:generate gorunpkg github.com/vektah/gqlgen +//go:generate gorunpkg github.com/99designs/gqlgen package {{ .PackageName }} diff --git a/codegen/type_build.go b/codegen/type_build.go index 4189763d69b..127791c0245 100644 --- a/codegen/type_build.go +++ b/codegen/type_build.go @@ -18,7 +18,7 @@ func (cfg *Config) buildNamedTypes() NamedTypes { t.IsUserDefined = true t.Package, t.GoType = pkgAndType(userEntry.Model) } else if t.IsScalar { - t.Package = "github.com/vektah/gqlgen/graphql" + t.Package = "github.com/99designs/gqlgen/graphql" t.GoType = "String" } diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md index acfd8ffb819..15b24d0da54 100644 --- a/docs/content/getting-started.md +++ b/docs/content/getting-started.md @@ -14,14 +14,14 @@ The aim for this tutorial is to build a "todo" graphql server that can: - create new todos - mark off todos as they are completed -You can find the finished code for this tutorial [here](https://github.com/vektah/gqlgen-tutorials/tree/master/gettingstarted) +You can find the finished code for this tutorial [here](https://github.com/99designs/gqlgen-tutorials/tree/master/gettingstarted) ## Install gqlgen Assuming you already have a working [go environment](https://golang.org/doc/install) you can simply go get: ```sh -go get -u github.com/vektah/gqlgen github.com/vektah/gorunpkg +go get -u github.com/99designs/gqlgen github.com/vektah/gorunpkg ``` ## Building the server @@ -91,13 +91,13 @@ And then tell gqlgen to use this new struct by adding this to the gqlgen.yml: ```yaml models: Todo: - model: github.com/vektah/gqlgen-tutorials/gettingstarted.Todo + model: github.com/99designs/gqlgen-tutorials/gettingstarted.Todo ``` and regenerate by running ```bash $ gqlgen -v -Unable to bind Todo.user to github.com/vektah/gqlgen-tutorials/gettingstarted.Todo +Unable to bind Todo.user to github.com/99designs/gqlgen-tutorials/gettingstarted.Todo no method named user no field named user Adding resolver method @@ -161,7 +161,7 @@ Now we just need to fill in the `not implemented` parts `graph/graph.go` ```go -//go:generate gorunpkg github.com/vektah/gqlgen +//go:generate gorunpkg github.com/99designs/gqlgen package gettingstarted @@ -250,7 +250,7 @@ First uninstall the global version we grabbed earlier. This is a good way to pre ```bash rm ~/go/bin/gqlgen -rm -rf ~/go/src/github.com/vektah/gqlgen +rm -rf ~/go/src/github.com/99designs/gqlgen ``` Next install gorunpkg, its kind of like npx but only searches vendor. @@ -262,7 +262,7 @@ dep ensure At the top of our resolvers.go a go generate command was added that looks like this: ```go -//go:generate gorunpkg github.com/vektah/gqlgen +//go:generate gorunpkg github.com/99designs/gqlgen ``` This magic comment tells `go generate` what command to run when we want to regenerate our code. to do so run: diff --git a/docs/content/introduction.md b/docs/content/introduction.md index 45e1a04b21e..67267f9336a 100644 --- a/docs/content/introduction.md +++ b/docs/content/introduction.md @@ -7,7 +7,7 @@ date: 2018-03-17T13:06:47+11:00 ## What is gqlgen? -[gqlgen](https://github.com/vektah/gqlgen) is golang library for building graphql servers without any fuss. gqlgen is: +[gqlgen](https://github.com/99designs/gqlgen) is golang library for building graphql servers without any fuss. gqlgen is: - Schema first: You define your API using the graphql [Schema Definition Language](http://graphql.org/learn/schema/) - Type safe: You should never see `map[string]interface{}` here. @@ -18,9 +18,9 @@ date: 2018-03-17T13:06:47+11:00 First take a look at the [Getting Started]({{< ref "getting-started.md" >}}) tutorial. -If you cant find what your looking for, maybe the [examples](https://github.com/vektah/gqlgen/tree/master/example) will help. +If you cant find what your looking for, maybe the [examples](https://github.com/99designs/gqlgen/tree/master/example) will help. ## Getting help -If you think you've found bug, or something isnt behaving the way you think it should please raise an [issue](https://github.com/vektah/gqlgen/issues) on github. +If you think you've found bug, or something isnt behaving the way you think it should please raise an [issue](https://github.com/99designs/gqlgen/issues) on github. diff --git a/docs/content/reference/dataloaders.md b/docs/content/reference/dataloaders.md index ad6c5506871..862d1f7166e 100644 --- a/docs/content/reference/dataloaders.md +++ b/docs/content/reference/dataloaders.md @@ -152,4 +152,4 @@ The generated UserLoader has a few other useful methods on it: - `LoadAll(keys)`: If you know up front you want a bunch users - `Prime(key, user)`: Used to sync state between similar loaders (usersById, usersByNote) -You can see the full working example [here](https://github.com/vektah/gqlgen-tutorials/tree/master/dataloader) +You can see the full working example [here](https://github.com/99designs/gqlgen-tutorials/tree/master/dataloader) diff --git a/docs/content/reference/scalars.md b/docs/content/reference/scalars.md index 775ed748555..5a126daae00 100644 --- a/docs/content/reference/scalars.md +++ b/docs/content/reference/scalars.md @@ -68,7 +68,7 @@ import ( "io" "strings" - "github.com/vektah/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql" ) @@ -103,4 +103,4 @@ models: model: github.com/me/mypkg.MyCustomBooleanScalar ``` -see the [example/scalars](https://github.com/vektah/gqlgen/tree/master/example/scalars) package for more examples. +see the [example/scalars](https://github.com/99designs/gqlgen/tree/master/example/scalars) package for more examples. diff --git a/docs/layouts/_default/single.html b/docs/layouts/_default/single.html index e0f1b5c55f6..6c6fb35b073 100644 --- a/docs/layouts/_default/single.html +++ b/docs/layouts/_default/single.html @@ -3,7 +3,7 @@
+ href="https://github.com/99designs/gqlgen/blob/master/docs/content/{{.File.Path }}"> [edit]

{{ .LinkTitle }}

diff --git a/docs/layouts/partials/sidebar.html b/docs/layouts/partials/sidebar.html index b476cc5a4d2..df01cdbe8a8 100644 --- a/docs/layouts/partials/sidebar.html +++ b/docs/layouts/partials/sidebar.html @@ -1,5 +1,5 @@