diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index d5dd9431f73..b3550fb51d9 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -22,12 +22,14 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ resolvers: cfg.Resolvers, directives: cfg.Directives, + complexity: cfg.Complexity, } } type Config struct { Resolvers ResolverRoot Directives DirectiveRoot + Complexity ComplexityRoot } type ResolverRoot interface { @@ -37,6 +39,10 @@ type ResolverRoot interface { type DirectiveRoot struct { } + +type ComplexityRoot struct { +} + type ForcedResolverResolver interface { Field(ctx context.Context, obj *ForcedResolver) (*Circle, error) } @@ -57,12 +63,20 @@ type QueryResolver interface { type executableSchema struct { resolvers ResolverRoot directives DirectiveRoot + complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { return parsedSchema } +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + switch typeName + "." + field { + + } + return 0, false +} + func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e} diff --git a/example/chat/generated.go b/example/chat/generated.go index e634ff91d7e..045f174eb51 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -20,12 +20,14 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ resolvers: cfg.Resolvers, directives: cfg.Directives, + complexity: cfg.Complexity, } } type Config struct { Resolvers ResolverRoot Directives DirectiveRoot + Complexity ComplexityRoot } type ResolverRoot interface { @@ -36,6 +38,10 @@ type ResolverRoot interface { type DirectiveRoot struct { } + +type ComplexityRoot struct { +} + type MutationResolver interface { Post(ctx context.Context, text string, username string, roomName string) (Message, error) } @@ -49,12 +55,20 @@ type SubscriptionResolver interface { type executableSchema struct { resolvers ResolverRoot directives DirectiveRoot + complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { return parsedSchema } +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + switch typeName + "." + field { + + } + return 0, false +} + func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e} diff --git a/example/config/generated.go b/example/config/generated.go index b8cb067bac0..1a9630cf7ac 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -19,12 +19,14 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ resolvers: cfg.Resolvers, directives: cfg.Directives, + complexity: cfg.Complexity, } } type Config struct { Resolvers ResolverRoot Directives DirectiveRoot + Complexity ComplexityRoot } type ResolverRoot interface { @@ -35,6 +37,10 @@ type ResolverRoot interface { type DirectiveRoot struct { } + +type ComplexityRoot struct { +} + type MutationResolver interface { CreateTodo(ctx context.Context, input NewTodo) (Todo, error) } @@ -48,12 +54,20 @@ type TodoResolver interface { type executableSchema struct { resolvers ResolverRoot directives DirectiveRoot + complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { return parsedSchema } +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + switch typeName + "." + field { + + } + return 0, false +} + func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e} diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index cc027df1569..66868820bbb 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -20,12 +20,14 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ resolvers: cfg.Resolvers, directives: cfg.Directives, + complexity: cfg.Complexity, } } type Config struct { Resolvers ResolverRoot Directives DirectiveRoot + Complexity ComplexityRoot } type ResolverRoot interface { @@ -36,6 +38,10 @@ type ResolverRoot interface { type DirectiveRoot struct { } + +type ComplexityRoot struct { +} + type CustomerResolver interface { Address(ctx context.Context, obj *Customer) (*Address, error) Orders(ctx context.Context, obj *Customer) ([]Order, error) @@ -52,12 +58,20 @@ type QueryResolver interface { type executableSchema struct { resolvers ResolverRoot directives DirectiveRoot + complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { return parsedSchema } +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + switch typeName + "." + field { + + } + return 0, false +} + func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e} diff --git a/example/scalars/generated.go b/example/scalars/generated.go index c4207e32199..79095299e58 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -22,12 +22,14 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ resolvers: cfg.Resolvers, directives: cfg.Directives, + complexity: cfg.Complexity, } } type Config struct { Resolvers ResolverRoot Directives DirectiveRoot + Complexity ComplexityRoot } type ResolverRoot interface { @@ -37,6 +39,10 @@ type ResolverRoot interface { type DirectiveRoot struct { } + +type ComplexityRoot struct { +} + type QueryResolver interface { User(ctx context.Context, id external.ObjectID) (*model.User, error) Search(ctx context.Context, input model.SearchArgs) ([]model.User, error) @@ -49,12 +55,20 @@ type UserResolver interface { type executableSchema struct { resolvers ResolverRoot directives DirectiveRoot + complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { return parsedSchema } +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + switch typeName + "." + field { + + } + return 0, false +} + func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e} diff --git a/example/selection/generated.go b/example/selection/generated.go index ab508ececb7..ece7139eeae 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -21,12 +21,14 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ resolvers: cfg.Resolvers, directives: cfg.Directives, + complexity: cfg.Complexity, } } type Config struct { Resolvers ResolverRoot Directives DirectiveRoot + Complexity ComplexityRoot } type ResolverRoot interface { @@ -35,6 +37,10 @@ type ResolverRoot interface { type DirectiveRoot struct { } + +type ComplexityRoot struct { +} + type QueryResolver interface { Events(ctx context.Context) ([]Event, error) } @@ -42,12 +48,20 @@ type QueryResolver interface { type executableSchema struct { resolvers ResolverRoot directives DirectiveRoot + complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { return parsedSchema } +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + switch typeName + "." + field { + + } + return 0, false +} + func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e} diff --git a/example/starwars/generated.go b/example/starwars/generated.go index bd208bb5242..61026759168 100644 --- a/example/starwars/generated.go +++ b/example/starwars/generated.go @@ -21,12 +21,14 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ resolvers: cfg.Resolvers, directives: cfg.Directives, + complexity: cfg.Complexity, } } type Config struct { Resolvers ResolverRoot Directives DirectiveRoot + Complexity ComplexityRoot } type ResolverRoot interface { @@ -40,6 +42,10 @@ type ResolverRoot interface { type DirectiveRoot struct { } + +type ComplexityRoot struct { +} + type DroidResolver interface { Friends(ctx context.Context, obj *Droid) ([]Character, error) FriendsConnection(ctx context.Context, obj *Droid, first *int, after *string) (FriendsConnection, error) @@ -73,12 +79,20 @@ type StarshipResolver interface { type executableSchema struct { resolvers ResolverRoot directives DirectiveRoot + complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { return parsedSchema } +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + switch typeName + "." + field { + + } + return 0, false +} + func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e} diff --git a/example/todo/generated.go b/example/todo/generated.go index 559b103e73c..e2eb03aec1e 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -19,12 +19,14 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ resolvers: cfg.Resolvers, directives: cfg.Directives, + complexity: cfg.Complexity, } } type Config struct { Resolvers ResolverRoot Directives DirectiveRoot + Complexity ComplexityRoot } type ResolverRoot interface { @@ -35,6 +37,10 @@ type ResolverRoot interface { type DirectiveRoot struct { HasRole func(ctx context.Context, next graphql.Resolver, role Role) (res interface{}, err error) } + +type ComplexityRoot struct { +} + type MyMutationResolver interface { CreateTodo(ctx context.Context, todo TodoInput) (Todo, error) UpdateTodo(ctx context.Context, id int, changes map[string]interface{}) (*Todo, error) @@ -49,12 +55,20 @@ type MyQueryResolver interface { type executableSchema struct { resolvers ResolverRoot directives DirectiveRoot + complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { return parsedSchema } +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + switch typeName + "." + field { + + } + return 0, false +} + func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e} diff --git a/integration/generated.go b/integration/generated.go index f7802ec3f8b..91019416cce 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -21,12 +21,14 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ resolvers: cfg.Resolvers, directives: cfg.Directives, + complexity: cfg.Complexity, } } type Config struct { Resolvers ResolverRoot Directives DirectiveRoot + Complexity ComplexityRoot } type ResolverRoot interface { @@ -38,6 +40,10 @@ type ResolverRoot interface { type DirectiveRoot struct { Magic func(ctx context.Context, next graphql.Resolver, kind *int) (res interface{}, err error) } + +type ComplexityRoot struct { +} + type ElementResolver interface { Child(ctx context.Context, obj *models.Element) (models.Element, error) Error(ctx context.Context, obj *models.Element) (bool, error) @@ -57,12 +63,20 @@ type UserResolver interface { type executableSchema struct { resolvers ResolverRoot directives DirectiveRoot + complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { return parsedSchema } +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + switch typeName + "." + field { + + } + return 0, false +} + func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e}