aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/graph/gen_graph.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-04-05 01:13:17 +0200
committerMichael Muré <batolettre@gmail.com>2019-04-05 01:13:17 +0200
commite027d5ee65aad72ca7cface8e609ea0c65f99fbe (patch)
tree3b67170e86c4158dd2dd4f23f3013641505dac35 /graphql/graph/gen_graph.go
parentb9e413c5f95212a0076aae0f473226b32b5fc77a (diff)
downloadgit-bug-e027d5ee65aad72ca7cface8e609ea0c65f99fbe.tar.gz
graphql: make Bug's actors and participants a connection
Diffstat (limited to 'graphql/graph/gen_graph.go')
-rw-r--r--graphql/graph/gen_graph.go340
1 files changed, 218 insertions, 122 deletions
diff --git a/graphql/graph/gen_graph.go b/graphql/graph/gen_graph.go
index 9da0c665..9c0003f2 100644
--- a/graphql/graph/gen_graph.go
+++ b/graphql/graph/gen_graph.go
@@ -87,10 +87,10 @@ type ComplexityRoot struct {
Title func(childComplexity int) int
Labels func(childComplexity int) int
Author func(childComplexity int) int
- Actors func(childComplexity int) int
- Participants func(childComplexity int) int
CreatedAt func(childComplexity int) int
LastEdit func(childComplexity int) int
+ Actors func(childComplexity int, after *string, before *string, first *int, last *int) int
+ Participants func(childComplexity int, after *string, before *string, first *int, last *int) int
Comments func(childComplexity int, after *string, before *string, first *int, last *int) int
Timeline func(childComplexity int, after *string, before *string, first *int, last *int) int
Operations func(childComplexity int, after *string, before *string, first *int, last *int) int
@@ -295,10 +295,9 @@ type AddCommentTimelineItemResolver interface {
type BugResolver interface {
Status(ctx context.Context, obj *bug.Snapshot) (models.Status, error)
- Actors(ctx context.Context, obj *bug.Snapshot) ([]*identity.Interface, error)
- Participants(ctx context.Context, obj *bug.Snapshot) ([]*identity.Interface, error)
-
LastEdit(ctx context.Context, obj *bug.Snapshot) (time.Time, error)
+ Actors(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.IdentityConnection, error)
+ Participants(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.IdentityConnection, error)
Comments(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.CommentConnection, error)
Timeline(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.TimelineItemConnection, error)
Operations(ctx context.Context, obj *bug.Snapshot, after *string, before *string, first *int, last *int) (models.OperationConnection, error)
@@ -367,6 +366,130 @@ type SetTitleTimelineItemResolver interface {
Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (time.Time, error)
}
+func field_Bug_actors_args(rawArgs map[string]interface{}) (map[string]interface{}, error) {
+ args := map[string]interface{}{}
+ var arg0 *string
+ if tmp, ok := rawArgs["after"]; ok {
+ var err error
+ var ptr1 string
+ if tmp != nil {
+ ptr1, err = graphql.UnmarshalString(tmp)
+ arg0 = &ptr1
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ }
+ args["after"] = arg0
+ var arg1 *string
+ if tmp, ok := rawArgs["before"]; ok {
+ var err error
+ var ptr1 string
+ if tmp != nil {
+ ptr1, err = graphql.UnmarshalString(tmp)
+ arg1 = &ptr1
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ }
+ args["before"] = arg1
+ var arg2 *int
+ if tmp, ok := rawArgs["first"]; ok {
+ var err error
+ var ptr1 int
+ if tmp != nil {
+ ptr1, err = graphql.UnmarshalInt(tmp)
+ arg2 = &ptr1
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ }
+ args["first"] = arg2
+ var arg3 *int
+ if tmp, ok := rawArgs["last"]; ok {
+ var err error
+ var ptr1 int
+ if tmp != nil {
+ ptr1, err = graphql.UnmarshalInt(tmp)
+ arg3 = &ptr1
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ }
+ args["last"] = arg3
+ return args, nil
+
+}
+
+func field_Bug_participants_args(rawArgs map[string]interface{}) (map[string]interface{}, error) {
+ args := map[string]interface{}{}
+ var arg0 *string
+ if tmp, ok := rawArgs["after"]; ok {
+ var err error
+ var ptr1 string
+ if tmp != nil {
+ ptr1, err = graphql.UnmarshalString(tmp)
+ arg0 = &ptr1
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ }
+ args["after"] = arg0
+ var arg1 *string
+ if tmp, ok := rawArgs["before"]; ok {
+ var err error
+ var ptr1 string
+ if tmp != nil {
+ ptr1, err = graphql.UnmarshalString(tmp)
+ arg1 = &ptr1
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ }
+ args["before"] = arg1
+ var arg2 *int
+ if tmp, ok := rawArgs["first"]; ok {
+ var err error
+ var ptr1 int
+ if tmp != nil {
+ ptr1, err = graphql.UnmarshalInt(tmp)
+ arg2 = &ptr1
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ }
+ args["first"] = arg2
+ var arg3 *int
+ if tmp, ok := rawArgs["last"]; ok {
+ var err error
+ var ptr1 int
+ if tmp != nil {
+ ptr1, err = graphql.UnmarshalInt(tmp)
+ arg3 = &ptr1
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ }
+ args["last"] = arg3
+ return args, nil
+
+}
+
func field_Bug_comments_args(rawArgs map[string]interface{}) (map[string]interface{}, error) {
args := map[string]interface{}{}
var arg0 *string
@@ -1244,33 +1367,43 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Bug.Author(childComplexity), true
- case "Bug.actors":
- if e.complexity.Bug.Actors == nil {
+ case "Bug.createdAt":
+ if e.complexity.Bug.CreatedAt == nil {
break
}
- return e.complexity.Bug.Actors(childComplexity), true
+ return e.complexity.Bug.CreatedAt(childComplexity), true
- case "Bug.participants":
- if e.complexity.Bug.Participants == nil {
+ case "Bug.lastEdit":
+ if e.complexity.Bug.LastEdit == nil {
break
}
- return e.complexity.Bug.Participants(childComplexity), true
+ return e.complexity.Bug.LastEdit(childComplexity), true
- case "Bug.createdAt":
- if e.complexity.Bug.CreatedAt == nil {
+ case "Bug.actors":
+ if e.complexity.Bug.Actors == nil {
break
}
- return e.complexity.Bug.CreatedAt(childComplexity), true
+ args, err := field_Bug_actors_args(rawArgs)
+ if err != nil {
+ return 0, false
+ }
- case "Bug.lastEdit":
- if e.complexity.Bug.LastEdit == nil {
+ return e.complexity.Bug.Actors(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true
+
+ case "Bug.participants":
+ if e.complexity.Bug.Participants == nil {
break
}
- return e.complexity.Bug.LastEdit(childComplexity), true
+ args, err := field_Bug_participants_args(rawArgs)
+ if err != nil {
+ return 0, false
+ }
+
+ return e.complexity.Bug.Participants(childComplexity, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int)), true
case "Bug.comments":
if e.complexity.Bug.Comments == nil {
@@ -2798,33 +2931,33 @@ func (ec *executionContext) _Bug(ctx context.Context, sel ast.SelectionSet, obj
if out.Values[i] == graphql.Null {
invalid = true
}
- case "actors":
+ case "createdAt":
+ out.Values[i] = ec._Bug_createdAt(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ invalid = true
+ }
+ case "lastEdit":
wg.Add(1)
go func(i int, field graphql.CollectedField) {
- out.Values[i] = ec._Bug_actors(ctx, field, obj)
+ out.Values[i] = ec._Bug_lastEdit(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalid = true
}
wg.Done()
}(i, field)
- case "participants":
+ case "actors":
wg.Add(1)
go func(i int, field graphql.CollectedField) {
- out.Values[i] = ec._Bug_participants(ctx, field, obj)
+ out.Values[i] = ec._Bug_actors(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalid = true
}
wg.Done()
}(i, field)
- case "createdAt":
- out.Values[i] = ec._Bug_createdAt(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- invalid = true
- }
- case "lastEdit":
+ case "participants":
wg.Add(1)
go func(i int, field graphql.CollectedField) {
- out.Values[i] = ec._Bug_lastEdit(ctx, field, obj)
+ out.Values[i] = ec._Bug_participants(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalid = true
}
@@ -3041,7 +3174,7 @@ func (ec *executionContext) _Bug_author(ctx context.Context, field graphql.Colle
}
// nolint: vetshadow
-func (ec *executionContext) _Bug_actors(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler {
+func (ec *executionContext) _Bug_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler {
ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() { ec.Tracer.EndFieldExecution(ctx) }()
rctx := &graphql.ResolverContext{
@@ -3053,7 +3186,7 @@ func (ec *executionContext) _Bug_actors(ctx context.Context, field graphql.Colle
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Bug().Actors(rctx, obj)
+ return obj.CreatedAt, nil
})
if resTmp == nil {
if !ec.HasError(rctx) {
@@ -3061,51 +3194,14 @@ func (ec *executionContext) _Bug_actors(ctx context.Context, field graphql.Colle
}
return graphql.Null
}
- res := resTmp.([]*identity.Interface)
+ res := resTmp.(time.Time)
rctx.Result = res
ctx = ec.Tracer.StartFieldChildExecution(ctx)
-
- arr1 := make(graphql.Array, len(res))
- var wg sync.WaitGroup
-
- isLen1 := len(res) == 1
- if !isLen1 {
- wg.Add(len(res))
- }
-
- for idx1 := range res {
- idx1 := idx1
- rctx := &graphql.ResolverContext{
- Index: &idx1,
- Result: res[idx1],
- }
- ctx := graphql.WithResolverContext(ctx, rctx)
- f := func(idx1 int) {
- if !isLen1 {
- defer wg.Done()
- }
- arr1[idx1] = func() graphql.Marshaler {
-
- if res[idx1] == nil {
- return graphql.Null
- }
-
- return ec._Identity(ctx, field.Selections, res[idx1])
- }()
- }
- if isLen1 {
- f(idx1)
- } else {
- go f(idx1)
- }
-
- }
- wg.Wait()
- return arr1
+ return graphql.MarshalTime(res)
}
// nolint: vetshadow
-func (ec *executionContext) _Bug_participants(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler {
+func (ec *executionContext) _Bug_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler {
ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() { ec.Tracer.EndFieldExecution(ctx) }()
rctx := &graphql.ResolverContext{
@@ -3117,7 +3213,7 @@ func (ec *executionContext) _Bug_participants(ctx context.Context, field graphql
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Bug().Participants(rctx, obj)
+ return ec.resolvers.Bug().LastEdit(rctx, obj)
})
if resTmp == nil {
if !ec.HasError(rctx) {
@@ -3125,63 +3221,32 @@ func (ec *executionContext) _Bug_participants(ctx context.Context, field graphql
}
return graphql.Null
}
- res := resTmp.([]*identity.Interface)
+ res := resTmp.(time.Time)
rctx.Result = res
ctx = ec.Tracer.StartFieldChildExecution(ctx)
-
- arr1 := make(graphql.Array, len(res))
- var wg sync.WaitGroup
-
- isLen1 := len(res) == 1
- if !isLen1 {
- wg.Add(len(res))
- }
-
- for idx1 := range res {
- idx1 := idx1
- rctx := &graphql.ResolverContext{
- Index: &idx1,
- Result: res[idx1],
- }
- ctx := graphql.WithResolverContext(ctx, rctx)
- f := func(idx1 int) {
- if !isLen1 {
- defer wg.Done()
- }
- arr1[idx1] = func() graphql.Marshaler {
-
- if res[idx1] == nil {
- return graphql.Null
- }
-
- return ec._Identity(ctx, field.Selections, res[idx1])
- }()
- }
- if isLen1 {
- f(idx1)
- } else {
- go f(idx1)
- }
-
- }
- wg.Wait()
- return arr1
+ return graphql.MarshalTime(res)
}
// nolint: vetshadow
-func (ec *executionContext) _Bug_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler {
+func (ec *executionContext) _Bug_actors(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler {
ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() { ec.Tracer.EndFieldExecution(ctx) }()
+ rawArgs := field.ArgumentMap(ec.Variables)
+ args, err := field_Bug_actors_args(rawArgs)
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
rctx := &graphql.ResolverContext{
Object: "Bug",
- Args: nil,
+ Args: args,
Field: field,
}
ctx = graphql.WithResolverContext(ctx, rctx)
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.CreatedAt, nil
+ return ec.resolvers.Bug().Actors(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int))
})
if resTmp == nil {
if !ec.HasError(rctx) {
@@ -3189,26 +3254,33 @@ func (ec *executionContext) _Bug_createdAt(ctx context.Context, field graphql.Co
}
return graphql.Null
}
- res := resTmp.(time.Time)
+ res := resTmp.(models.IdentityConnection)
rctx.Result = res
ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return graphql.MarshalTime(res)
+
+ return ec._IdentityConnection(ctx, field.Selections, &res)
}
// nolint: vetshadow
-func (ec *executionContext) _Bug_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler {
+func (ec *executionContext) _Bug_participants(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler {
ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() { ec.Tracer.EndFieldExecution(ctx) }()
+ rawArgs := field.ArgumentMap(ec.Variables)
+ args, err := field_Bug_participants_args(rawArgs)
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
rctx := &graphql.ResolverContext{
Object: "Bug",
- Args: nil,
+ Args: args,
Field: field,
}
ctx = graphql.WithResolverContext(ctx, rctx)
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Bug().LastEdit(rctx, obj)
+ return ec.resolvers.Bug().Participants(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int))
})
if resTmp == nil {
if !ec.HasError(rctx) {
@@ -3216,10 +3288,11 @@ func (ec *executionContext) _Bug_lastEdit(ctx context.Context, field graphql.Col
}
return graphql.Null
}
- res := resTmp.(time.Time)
+ res := resTmp.(models.IdentityConnection)
rctx.Result = res
ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return graphql.MarshalTime(res)
+
+ return ec._IdentityConnection(ctx, field.Selections, &res)
}
// nolint: vetshadow
@@ -9802,11 +9875,34 @@ type Bug {
title: String!
labels: [Label!]!
author: Identity!
- actors: [Identity]!
- participants: [Identity]!
createdAt: Time!
lastEdit: Time!
+ """The actors of the bug. Actors are Identity that have interacted with the bug."""
+ actors(
+ """Returns the elements in the list that come after the specified cursor."""
+ after: String
+ """Returns the elements in the list that come before the specified cursor."""
+ before: String
+ """Returns the first _n_ elements from the list."""
+ first: Int
+ """Returns the last _n_ elements from the list."""
+ last: Int
+ ): IdentityConnection!
+
+ """The participants of the bug. Participants are Identity that have created or
+ added a comment on the bug."""
+ participants(
+ """Returns the elements in the list that come after the specified cursor."""
+ after: String
+ """Returns the elements in the list that come before the specified cursor."""
+ before: String
+ """Returns the first _n_ elements from the list."""
+ first: Int
+ """Returns the last _n_ elements from the list."""
+ last: Int
+ ): IdentityConnection!
+
comments(
"""Returns the elements in the list that come after the specified cursor."""
after: String