From 8416324766817e69d984d6e39e51e68758795b8f Mon Sep 17 00:00:00 2001 From: Mathew Byrne Date: Wed, 25 Jul 2018 16:33:13 +1000 Subject: [PATCH] Regenerate --- example/chat/generated.go | 18 +++++++++++++----- example/dataloader/generated.go | 14 +++++++++++--- example/scalars/generated.go | 14 +++++++++++--- example/selection/generated.go | 14 +++++++++++--- example/starwars/generated.go | 16 ++++++++++++---- example/todo/generated.go | 27 +++++++++++++++++++++++---- test/generated.go | 14 +++++++++++--- 7 files changed, 92 insertions(+), 25 deletions(-) diff --git a/example/chat/generated.go b/example/chat/generated.go index 63a8467092..51711c680f 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -55,7 +55,7 @@ func (e *executableSchema) Schema() *ast.Schema { } func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { data := ec._Query(ctx, op.SelectionSet) @@ -71,7 +71,7 @@ func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinitio } func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { data := ec._Mutation(ctx, op.SelectionSet) @@ -87,7 +87,7 @@ func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefini } func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} next := ec._Subscription(ctx, op.SelectionSet) if ec.Errors != nil { @@ -116,8 +116,7 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe type executionContext struct { *graphql.RequestContext - - resolvers ResolverRoot + *executableSchema } var chatroomImplementors = []string{"Chatroom"} @@ -1396,6 +1395,15 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return ec.___Type(ctx, field.Selections, res) } +func (ec *executionContext) FieldMiddleware(ctx context.Context, next graphql.Resolver) interface{} { + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res +} + func (ec *executionContext) introspectSchema() *introspection.Schema { return introspection.WrapSchema(parsedSchema) } diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index beeb0313cb..21b4abdc7f 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -57,7 +57,7 @@ func (e *executableSchema) Schema() *ast.Schema { } func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { data := ec._Query(ctx, op.SelectionSet) @@ -82,8 +82,7 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe type executionContext struct { *graphql.RequestContext - - resolvers ResolverRoot + *executableSchema } var addressImplementors = []string{"Address"} @@ -1502,6 +1501,15 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return ec.___Type(ctx, field.Selections, res) } +func (ec *executionContext) FieldMiddleware(ctx context.Context, next graphql.Resolver) interface{} { + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res +} + func (ec *executionContext) introspectSchema() *introspection.Schema { return introspection.WrapSchema(parsedSchema) } diff --git a/example/scalars/generated.go b/example/scalars/generated.go index 9382cc4176..2fc6575914 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -55,7 +55,7 @@ func (e *executableSchema) Schema() *ast.Schema { } func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { data := ec._Query(ctx, op.SelectionSet) @@ -80,8 +80,7 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe type executionContext struct { *graphql.RequestContext - - resolvers ResolverRoot + *executableSchema } var addressImplementors = []string{"Address"} @@ -1423,6 +1422,15 @@ func UnmarshalSearchArgs(v interface{}) (model.SearchArgs, error) { return it, nil } +func (ec *executionContext) FieldMiddleware(ctx context.Context, next graphql.Resolver) interface{} { + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res +} + func (ec *executionContext) introspectSchema() *introspection.Schema { return introspection.WrapSchema(parsedSchema) } diff --git a/example/selection/generated.go b/example/selection/generated.go index 3f0ad126e3..db02424f8c 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -48,7 +48,7 @@ func (e *executableSchema) Schema() *ast.Schema { } func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { data := ec._Query(ctx, op.SelectionSet) @@ -73,8 +73,7 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe type executionContext struct { *graphql.RequestContext - - resolvers ResolverRoot + *executableSchema } var likeImplementors = []string{"Like", "Event"} @@ -1305,6 +1304,15 @@ func (ec *executionContext) _Event(ctx context.Context, sel ast.SelectionSet, ob } } +func (ec *executionContext) FieldMiddleware(ctx context.Context, next graphql.Resolver) interface{} { + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res +} + func (ec *executionContext) introspectSchema() *introspection.Schema { return introspection.WrapSchema(parsedSchema) } diff --git a/example/starwars/generated.go b/example/starwars/generated.go index c131e58278..3cc8a734d6 100644 --- a/example/starwars/generated.go +++ b/example/starwars/generated.go @@ -79,7 +79,7 @@ func (e *executableSchema) Schema() *ast.Schema { } func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { data := ec._Query(ctx, op.SelectionSet) @@ -95,7 +95,7 @@ func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinitio } func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { data := ec._Mutation(ctx, op.SelectionSet) @@ -116,8 +116,7 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe type executionContext struct { *graphql.RequestContext - - resolvers ResolverRoot + *executableSchema } var droidImplementors = []string{"Droid", "Character"} @@ -2504,6 +2503,15 @@ func UnmarshalReviewInput(v interface{}) (Review, error) { return it, nil } +func (ec *executionContext) FieldMiddleware(ctx context.Context, next graphql.Resolver) interface{} { + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res +} + func (ec *executionContext) introspectSchema() *introspection.Schema { return introspection.WrapSchema(parsedSchema) } diff --git a/example/todo/generated.go b/example/todo/generated.go index 953a377b8f..eea9f41ce4 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -54,7 +54,7 @@ func (e *executableSchema) Schema() *ast.Schema { } func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { data := ec._MyQuery(ctx, op.SelectionSet) @@ -70,7 +70,7 @@ func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinitio } func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { data := ec._MyMutation(ctx, op.SelectionSet) @@ -91,8 +91,7 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe type executionContext struct { *graphql.RequestContext - - resolvers ResolverRoot + *executableSchema } var myMutationImplementors = []string{"MyMutation"} @@ -1354,6 +1353,26 @@ func UnmarshalTodoInput(v interface{}) (TodoInput, error) { return it, nil } +func (ec *executionContext) FieldMiddleware(ctx context.Context, next graphql.Resolver) interface{} { + rctx := graphql.GetResolverContext(ctx) + if len(rctx.Field.Directives) != 0 { + for _, d := range rctx.Field.Directives { + switch d.Name { + case "isAuthenticated": + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.IsAuthenticated(ctx, next) + } + } + } + } + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res +} + func (ec *executionContext) introspectSchema() *introspection.Schema { return introspection.WrapSchema(parsedSchema) } diff --git a/test/generated.go b/test/generated.go index 2508c4a319..36268ffa58 100644 --- a/test/generated.go +++ b/test/generated.go @@ -61,7 +61,7 @@ func (e *executableSchema) Schema() *ast.Schema { } func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { - ec := executionContext{graphql.GetRequestContext(ctx), e.resolvers} + ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { data := ec._Query(ctx, op.SelectionSet) @@ -86,8 +86,7 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe type executionContext struct { *graphql.RequestContext - - resolvers ResolverRoot + *executableSchema } var elementImplementors = []string{"Element"} @@ -1453,6 +1452,15 @@ func UnmarshalDateFilter(v interface{}) (models.DateFilter, error) { return it, nil } +func (ec *executionContext) FieldMiddleware(ctx context.Context, next graphql.Resolver) interface{} { + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res +} + func (ec *executionContext) introspectSchema() *introspection.Schema { return introspection.WrapSchema(parsedSchema) }