From 6949d6c543e9397578c7c840812df9bbf8531528 Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Wed, 15 May 2019 15:04:57 +0200 Subject: Upgrade gqlgen version to v0.9.0 --- vendor/github.com/99designs/gqlgen/handler/mock.go | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 vendor/github.com/99designs/gqlgen/handler/mock.go (limited to 'vendor/github.com/99designs/gqlgen/handler/mock.go') diff --git a/vendor/github.com/99designs/gqlgen/handler/mock.go b/vendor/github.com/99designs/gqlgen/handler/mock.go new file mode 100644 index 00000000..3e70cf03 --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/handler/mock.go @@ -0,0 +1,57 @@ +package handler + +import ( + "context" + + "github.com/99designs/gqlgen/graphql" + "github.com/vektah/gqlparser" + "github.com/vektah/gqlparser/ast" +) + +type executableSchemaMock struct { + MutationFunc func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response +} + +var _ graphql.ExecutableSchema = &executableSchemaMock{} + +func (e *executableSchemaMock) Schema() *ast.Schema { + return gqlparser.MustLoadSchema(&ast.Source{Input: ` + schema { query: Query, mutation: Mutation } + type Query { + empty: String! + } + scalar Upload + type File { + id: Int! + } + input UploadFile { + id: Int! + file: Upload! + } + type Mutation { + singleUpload(file: Upload!): File! + singleUploadWithPayload(req: UploadFile!): File! + multipleUpload(files: [Upload!]!): [File!]! + multipleUploadWithPayload(req: [UploadFile!]!): [File!]! + } + `}) +} + +func (e *executableSchemaMock) Complexity(typeName, field string, childComplexity int, args map[string]interface{}) (int, bool) { + return 0, false +} + +func (e *executableSchemaMock) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return graphql.ErrorResponse(ctx, "queries are not supported") +} + +func (e *executableSchemaMock) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { + return e.MutationFunc(ctx, op) +} + +func (e *executableSchemaMock) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { + return func() *graphql.Response { + <-ctx.Done() + return nil + } +} -- cgit