aboutsummaryrefslogtreecommitdiffstats
path: root/graphql
diff options
context:
space:
mode:
Diffstat (limited to 'graphql')
-rw-r--r--graphql/connections/connections.go4
-rw-r--r--graphql/connections/gen_lazy_bug.go11
-rw-r--r--graphql/connections/gen_lazy_identity.go11
-rw-r--r--graphql/connections/lazy_bug.go4
-rw-r--r--graphql/connections/lazy_identity.go4
-rw-r--r--graphql/graph/gen_graph.go305
-rw-r--r--graphql/resolvers/bug.go8
-rw-r--r--graphql/resolvers/identity.go4
-rw-r--r--graphql/resolvers/operations.go45
-rw-r--r--graphql/resolvers/repo.go9
-rw-r--r--graphql/resolvers/root.go2
-rw-r--r--graphql/resolvers/timeline.go33
12 files changed, 340 insertions, 100 deletions
diff --git a/graphql/connections/connections.go b/graphql/connections/connections.go
index d54a5068..d82c5620 100644
--- a/graphql/connections/connections.go
+++ b/graphql/connections/connections.go
@@ -1,5 +1,5 @@
-//go:generate genny -in=connection_template.go -out=gen_lazy_bug.go gen "Name=LazyBug NodeType=string EdgeType=LazyBugEdge ConnectionType=models.BugConnection"
-//go:generate genny -in=connection_template.go -out=gen_lazy_identity.go gen "Name=LazyIdentity NodeType=string EdgeType=LazyIdentityEdge ConnectionType=models.IdentityConnection"
+//go:generate genny -in=connection_template.go -out=gen_lazy_bug.go gen "Name=LazyBug NodeType=entity.Id EdgeType=LazyBugEdge ConnectionType=models.BugConnection"
+//go:generate genny -in=connection_template.go -out=gen_lazy_identity.go gen "Name=LazyIdentity NodeType=entity.Id EdgeType=LazyIdentityEdge ConnectionType=models.IdentityConnection"
//go:generate genny -in=connection_template.go -out=gen_identity.go gen "Name=Identity NodeType=identity.Interface EdgeType=models.IdentityEdge ConnectionType=models.IdentityConnection"
//go:generate genny -in=connection_template.go -out=gen_operation.go gen "Name=Operation NodeType=bug.Operation EdgeType=models.OperationEdge ConnectionType=models.OperationConnection"
//go:generate genny -in=connection_template.go -out=gen_comment.go gen "Name=Comment NodeType=bug.Comment EdgeType=models.CommentEdge ConnectionType=models.CommentConnection"
diff --git a/graphql/connections/gen_lazy_bug.go b/graphql/connections/gen_lazy_bug.go
index 6c9eb012..9638e86b 100644
--- a/graphql/connections/gen_lazy_bug.go
+++ b/graphql/connections/gen_lazy_bug.go
@@ -7,23 +7,24 @@ package connections
import (
"fmt"
+ "github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/graphql/models"
)
-// StringEdgeMaker define a function that take a string and an offset and
+// EntityIdEdgeMaker define a function that take a entity.Id and an offset and
// create an Edge.
-type LazyBugEdgeMaker func(value string, offset int) Edge
+type LazyBugEdgeMaker func(value entity.Id, offset int) Edge
// LazyBugConMaker define a function that create a models.BugConnection
type LazyBugConMaker func(
edges []*LazyBugEdge,
- nodes []string,
+ nodes []entity.Id,
info *models.PageInfo,
totalCount int) (*models.BugConnection, error)
// LazyBugCon will paginate a source according to the input of a relay connection
-func LazyBugCon(source []string, edgeMaker LazyBugEdgeMaker, conMaker LazyBugConMaker, input models.ConnectionInput) (*models.BugConnection, error) {
- var nodes []string
+func LazyBugCon(source []entity.Id, edgeMaker LazyBugEdgeMaker, conMaker LazyBugConMaker, input models.ConnectionInput) (*models.BugConnection, error) {
+ var nodes []entity.Id
var edges []*LazyBugEdge
var cursors []string
var pageInfo = &models.PageInfo{}
diff --git a/graphql/connections/gen_lazy_identity.go b/graphql/connections/gen_lazy_identity.go
index 96461be5..932d802c 100644
--- a/graphql/connections/gen_lazy_identity.go
+++ b/graphql/connections/gen_lazy_identity.go
@@ -7,23 +7,24 @@ package connections
import (
"fmt"
+ "github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/graphql/models"
)
-// StringEdgeMaker define a function that take a string and an offset and
+// EntityIdEdgeMaker define a function that take a entity.Id and an offset and
// create an Edge.
-type LazyIdentityEdgeMaker func(value string, offset int) Edge
+type LazyIdentityEdgeMaker func(value entity.Id, offset int) Edge
// LazyIdentityConMaker define a function that create a models.IdentityConnection
type LazyIdentityConMaker func(
edges []*LazyIdentityEdge,
- nodes []string,
+ nodes []entity.Id,
info *models.PageInfo,
totalCount int) (*models.IdentityConnection, error)
// LazyIdentityCon will paginate a source according to the input of a relay connection
-func LazyIdentityCon(source []string, edgeMaker LazyIdentityEdgeMaker, conMaker LazyIdentityConMaker, input models.ConnectionInput) (*models.IdentityConnection, error) {
- var nodes []string
+func LazyIdentityCon(source []entity.Id, edgeMaker LazyIdentityEdgeMaker, conMaker LazyIdentityConMaker, input models.ConnectionInput) (*models.IdentityConnection, error) {
+ var nodes []entity.Id
var edges []*LazyIdentityEdge
var cursors []string
var pageInfo = &models.PageInfo{}
diff --git a/graphql/connections/lazy_bug.go b/graphql/connections/lazy_bug.go
index 24eda0b6..00692e8b 100644
--- a/graphql/connections/lazy_bug.go
+++ b/graphql/connections/lazy_bug.go
@@ -1,8 +1,10 @@
package connections
+import "github.com/MichaelMure/git-bug/entity"
+
// LazyBugEdge is a special relay edge used to implement a lazy loading connection
type LazyBugEdge struct {
- Id string
+ Id entity.Id
Cursor string
}
diff --git a/graphql/connections/lazy_identity.go b/graphql/connections/lazy_identity.go
index 34ba579a..3274dd7e 100644
--- a/graphql/connections/lazy_identity.go
+++ b/graphql/connections/lazy_identity.go
@@ -1,8 +1,10 @@
package connections
+import "github.com/MichaelMure/git-bug/entity"
+
// LazyIdentityEdge is a special relay edge used to implement a lazy loading connection
type LazyIdentityEdge struct {
- Id string
+ Id entity.Id
Cursor string
}
diff --git a/graphql/graph/gen_graph.go b/graphql/graph/gen_graph.go
index eaefc671..c052e57b 100644
--- a/graphql/graph/gen_graph.go
+++ b/graphql/graph/gen_graph.go
@@ -98,8 +98,8 @@ type ComplexityRoot struct {
Author func(childComplexity int) int
Comments func(childComplexity int, after *string, before *string, first *int, last *int) int
CreatedAt func(childComplexity int) int
- HumanId func(childComplexity int) int
- Id func(childComplexity int) int
+ HumanID func(childComplexity int) int
+ ID func(childComplexity int) int
Labels func(childComplexity int) int
LastEdit func(childComplexity int) int
Operations func(childComplexity int, after *string, before *string, first *int, last *int) int
@@ -358,13 +358,19 @@ type ComplexityRoot struct {
}
type AddCommentOperationResolver interface {
+ ID(ctx context.Context, obj *bug.AddCommentOperation) (string, error)
+
Date(ctx context.Context, obj *bug.AddCommentOperation) (*time.Time, error)
}
type AddCommentTimelineItemResolver interface {
+ ID(ctx context.Context, obj *bug.AddCommentTimelineItem) (string, error)
+
CreatedAt(ctx context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error)
LastEdit(ctx context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error)
}
type BugResolver interface {
+ ID(ctx context.Context, obj *bug.Snapshot) (string, error)
+ HumanID(ctx context.Context, obj *bug.Snapshot) (string, error)
Status(ctx context.Context, obj *bug.Snapshot) (models.Status, error)
LastEdit(ctx context.Context, obj *bug.Snapshot) (*time.Time, error)
@@ -383,14 +389,21 @@ type CommentHistoryStepResolver interface {
Date(ctx context.Context, obj *bug.CommentHistoryStep) (*time.Time, error)
}
type CreateOperationResolver interface {
+ ID(ctx context.Context, obj *bug.CreateOperation) (string, error)
+
Date(ctx context.Context, obj *bug.CreateOperation) (*time.Time, error)
}
type CreateTimelineItemResolver interface {
+ ID(ctx context.Context, obj *bug.CreateTimelineItem) (string, error)
+
CreatedAt(ctx context.Context, obj *bug.CreateTimelineItem) (*time.Time, error)
LastEdit(ctx context.Context, obj *bug.CreateTimelineItem) (*time.Time, error)
}
type EditCommentOperationResolver interface {
+ ID(ctx context.Context, obj *bug.EditCommentOperation) (string, error)
+
Date(ctx context.Context, obj *bug.EditCommentOperation) (*time.Time, error)
+ Target(ctx context.Context, obj *bug.EditCommentOperation) (string, error)
}
type IdentityResolver interface {
ID(ctx context.Context, obj *identity.Interface) (string, error)
@@ -407,12 +420,16 @@ type LabelResolver interface {
Color(ctx context.Context, obj *bug.Label) (*color.RGBA, error)
}
type LabelChangeOperationResolver interface {
+ ID(ctx context.Context, obj *bug.LabelChangeOperation) (string, error)
+
Date(ctx context.Context, obj *bug.LabelChangeOperation) (*time.Time, error)
}
type LabelChangeResultResolver interface {
Status(ctx context.Context, obj *bug.LabelChangeResult) (models.LabelChangeStatus, error)
}
type LabelChangeTimelineItemResolver interface {
+ ID(ctx context.Context, obj *bug.LabelChangeTimelineItem) (string, error)
+
Date(ctx context.Context, obj *bug.LabelChangeTimelineItem) (*time.Time, error)
}
type MutationResolver interface {
@@ -438,17 +455,25 @@ type RepositoryResolver interface {
ValidLabels(ctx context.Context, obj *models.Repository) ([]bug.Label, error)
}
type SetStatusOperationResolver interface {
+ ID(ctx context.Context, obj *bug.SetStatusOperation) (string, error)
+
Date(ctx context.Context, obj *bug.SetStatusOperation) (*time.Time, error)
Status(ctx context.Context, obj *bug.SetStatusOperation) (models.Status, error)
}
type SetStatusTimelineItemResolver interface {
+ ID(ctx context.Context, obj *bug.SetStatusTimelineItem) (string, error)
+
Date(ctx context.Context, obj *bug.SetStatusTimelineItem) (*time.Time, error)
Status(ctx context.Context, obj *bug.SetStatusTimelineItem) (models.Status, error)
}
type SetTitleOperationResolver interface {
+ ID(ctx context.Context, obj *bug.SetTitleOperation) (string, error)
+
Date(ctx context.Context, obj *bug.SetTitleOperation) (*time.Time, error)
}
type SetTitleTimelineItemResolver interface {
+ ID(ctx context.Context, obj *bug.SetTitleTimelineItem) (string, error)
+
Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (*time.Time, error)
}
@@ -625,18 +650,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Bug.CreatedAt(childComplexity), true
case "Bug.humanId":
- if e.complexity.Bug.HumanId == nil {
+ if e.complexity.Bug.HumanID == nil {
break
}
- return e.complexity.Bug.HumanId(childComplexity), true
+ return e.complexity.Bug.HumanID(childComplexity), true
case "Bug.id":
- if e.complexity.Bug.Id == nil {
+ if e.complexity.Bug.ID == nil {
break
}
- return e.complexity.Bug.Id(childComplexity), true
+ return e.complexity.Bug.ID(childComplexity), true
case "Bug.labels":
if e.complexity.Bug.Labels == nil {
@@ -2918,7 +2943,7 @@ func (ec *executionContext) _AddCommentOperation_id(ctx context.Context, field g
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.AddCommentOperation().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -3211,7 +3236,7 @@ func (ec *executionContext) _AddCommentTimelineItem_id(ctx context.Context, fiel
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.AddCommentTimelineItem().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -3544,7 +3569,7 @@ func (ec *executionContext) _Bug_id(ctx context.Context, field graphql.Collected
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.Id(), nil
+ return ec.resolvers.Bug().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -3581,7 +3606,7 @@ func (ec *executionContext) _Bug_humanId(ctx context.Context, field graphql.Coll
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.HumanId(), nil
+ return ec.resolvers.Bug().HumanID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -5195,7 +5220,7 @@ func (ec *executionContext) _CreateOperation_id(ctx context.Context, field graph
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.CreateOperation().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -5417,7 +5442,7 @@ func (ec *executionContext) _CreateTimelineItem_id(ctx context.Context, field gr
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.CreateTimelineItem().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -5750,7 +5775,7 @@ func (ec *executionContext) _EditCommentOperation_id(ctx context.Context, field
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.EditCommentOperation().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -5855,13 +5880,13 @@ func (ec *executionContext) _EditCommentOperation_target(ctx context.Context, fi
Object: "EditCommentOperation",
Field: field,
Args: nil,
- IsMethod: false,
+ IsMethod: true,
}
ctx = graphql.WithResolverContext(ctx, rctx)
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.Target, nil
+ return ec.resolvers.EditCommentOperation().Target(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -6552,7 +6577,7 @@ func (ec *executionContext) _LabelChangeOperation_id(ctx context.Context, field
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.LabelChangeOperation().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -6811,7 +6836,7 @@ func (ec *executionContext) _LabelChangeTimelineItem_id(ctx context.Context, fie
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.LabelChangeTimelineItem().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -8325,7 +8350,7 @@ func (ec *executionContext) _SetStatusOperation_id(ctx context.Context, field gr
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.SetStatusOperation().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -8473,7 +8498,7 @@ func (ec *executionContext) _SetStatusTimelineItem_id(ctx context.Context, field
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.SetStatusTimelineItem().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -8621,7 +8646,7 @@ func (ec *executionContext) _SetTitleOperation_id(ctx context.Context, field gra
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.SetTitleOperation().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -8914,7 +8939,7 @@ func (ec *executionContext) _SetTitleTimelineItem_id(ctx context.Context, field
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return obj.ID(), nil
+ return ec.resolvers.SetTitleTimelineItem().ID(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -10838,10 +10863,19 @@ func (ec *executionContext) _AddCommentOperation(ctx context.Context, sel ast.Se
case "__typename":
out.Values[i] = graphql.MarshalString("AddCommentOperation")
case "id":
- out.Values[i] = ec._AddCommentOperation_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._AddCommentOperation_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._AddCommentOperation_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -10928,10 +10962,19 @@ func (ec *executionContext) _AddCommentTimelineItem(ctx context.Context, sel ast
case "__typename":
out.Values[i] = graphql.MarshalString("AddCommentTimelineItem")
case "id":
- out.Values[i] = ec._AddCommentTimelineItem_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._AddCommentTimelineItem_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._AddCommentTimelineItem_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -11013,15 +11056,33 @@ func (ec *executionContext) _Bug(ctx context.Context, sel ast.SelectionSet, obj
case "__typename":
out.Values[i] = graphql.MarshalString("Bug")
case "id":
- out.Values[i] = ec._Bug_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._Bug_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "humanId":
- out.Values[i] = ec._Bug_humanId(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._Bug_humanId(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "status":
field := field
out.Concurrently(i, func() (res graphql.Marshaler) {
@@ -11584,10 +11645,19 @@ func (ec *executionContext) _CreateOperation(ctx context.Context, sel ast.Select
case "__typename":
out.Values[i] = graphql.MarshalString("CreateOperation")
case "id":
- out.Values[i] = ec._CreateOperation_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._CreateOperation_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._CreateOperation_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -11645,10 +11715,19 @@ func (ec *executionContext) _CreateTimelineItem(ctx context.Context, sel ast.Sel
case "__typename":
out.Values[i] = graphql.MarshalString("CreateTimelineItem")
case "id":
- out.Values[i] = ec._CreateTimelineItem_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._CreateTimelineItem_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._CreateTimelineItem_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -11730,10 +11809,19 @@ func (ec *executionContext) _EditCommentOperation(ctx context.Context, sel ast.S
case "__typename":
out.Values[i] = graphql.MarshalString("EditCommentOperation")
case "id":
- out.Values[i] = ec._EditCommentOperation_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._EditCommentOperation_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._EditCommentOperation_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -11754,10 +11842,19 @@ func (ec *executionContext) _EditCommentOperation(ctx context.Context, sel ast.S
return res
})
case "target":
- out.Values[i] = ec._EditCommentOperation_target(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._EditCommentOperation_target(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "message":
out.Values[i] = ec._EditCommentOperation_message(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -12037,10 +12134,19 @@ func (ec *executionContext) _LabelChangeOperation(ctx context.Context, sel ast.S
case "__typename":
out.Values[i] = graphql.MarshalString("LabelChangeOperation")
case "id":
- out.Values[i] = ec._LabelChangeOperation_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._LabelChangeOperation_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._LabelChangeOperation_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -12134,10 +12240,19 @@ func (ec *executionContext) _LabelChangeTimelineItem(ctx context.Context, sel as
case "__typename":
out.Values[i] = graphql.MarshalString("LabelChangeTimelineItem")
case "id":
- out.Values[i] = ec._LabelChangeTimelineItem_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._LabelChangeTimelineItem_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._LabelChangeTimelineItem_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -12589,10 +12704,19 @@ func (ec *executionContext) _SetStatusOperation(ctx context.Context, sel ast.Sel
case "__typename":
out.Values[i] = graphql.MarshalString("SetStatusOperation")
case "id":
- out.Values[i] = ec._SetStatusOperation_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._SetStatusOperation_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._SetStatusOperation_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -12649,10 +12773,19 @@ func (ec *executionContext) _SetStatusTimelineItem(ctx context.Context, sel ast.
case "__typename":
out.Values[i] = graphql.MarshalString("SetStatusTimelineItem")
case "id":
- out.Values[i] = ec._SetStatusTimelineItem_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._SetStatusTimelineItem_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._SetStatusTimelineItem_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -12709,10 +12842,19 @@ func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.Sele
case "__typename":
out.Values[i] = graphql.MarshalString("SetTitleOperation")
case "id":
- out.Values[i] = ec._SetTitleOperation_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._SetTitleOperation_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._SetTitleOperation_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -12799,10 +12941,19 @@ func (ec *executionContext) _SetTitleTimelineItem(ctx context.Context, sel ast.S
case "__typename":
out.Values[i] = graphql.MarshalString("SetTitleTimelineItem")
case "id":
- out.Values[i] = ec._SetTitleTimelineItem_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._SetTitleTimelineItem_id(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
+ return res
+ })
case "author":
out.Values[i] = ec._SetTitleTimelineItem_author(ctx, field, obj)
if out.Values[i] == graphql.Null {
diff --git a/graphql/resolvers/bug.go b/graphql/resolvers/bug.go
index 37766b95..8f994c0b 100644
--- a/graphql/resolvers/bug.go
+++ b/graphql/resolvers/bug.go
@@ -15,6 +15,14 @@ var _ graph.BugResolver = &bugResolver{}
type bugResolver struct{}
+func (bugResolver) ID(ctx context.Context, obj *bug.Snapshot) (string, error) {
+ return obj.Id().String(), nil
+}
+
+func (bugResolver) HumanID(ctx context.Context, obj *bug.Snapshot) (string, error) {
+ return obj.Id().Human(), nil
+}
+
func (bugResolver) Status(ctx context.Context, obj *bug.Snapshot) (models.Status, error) {
return convertStatus(obj.Status)
}
diff --git a/graphql/resolvers/identity.go b/graphql/resolvers/identity.go
index 05f7207e..ee40d4d8 100644
--- a/graphql/resolvers/identity.go
+++ b/graphql/resolvers/identity.go
@@ -12,11 +12,11 @@ var _ graph.IdentityResolver = &identityResolver{}
type identityResolver struct{}
func (identityResolver) ID(ctx context.Context, obj *identity.Interface) (string, error) {
- return (*obj).Id(), nil
+ return (*obj).Id().String(), nil
}
func (identityResolver) HumanID(ctx context.Context, obj *identity.Interface) (string, error) {
- return (*obj).HumanId(), nil
+ return (*obj).Id().Human(), nil
}
func (identityResolver) Name(ctx context.Context, obj *identity.Interface) (*string, error) {
diff --git a/graphql/resolvers/operations.go b/graphql/resolvers/operations.go
index 19b2b17f..3080c98b 100644
--- a/graphql/resolvers/operations.go
+++ b/graphql/resolvers/operations.go
@@ -6,39 +6,74 @@ import (
"time"
"github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/graphql/graph"
"github.com/MichaelMure/git-bug/graphql/models"
)
+var _ graph.CreateOperationResolver = createOperationResolver{}
+
type createOperationResolver struct{}
+func (createOperationResolver) ID(ctx context.Context, obj *bug.CreateOperation) (string, error) {
+ return obj.Id().String(), nil
+}
+
func (createOperationResolver) Date(ctx context.Context, obj *bug.CreateOperation) (*time.Time, error) {
t := obj.Time()
return &t, nil
}
+var _ graph.AddCommentOperationResolver = addCommentOperationResolver{}
+
type addCommentOperationResolver struct{}
+func (addCommentOperationResolver) ID(ctx context.Context, obj *bug.AddCommentOperation) (string, error) {
+ return obj.Id().String(), nil
+}
+
func (addCommentOperationResolver) Date(ctx context.Context, obj *bug.AddCommentOperation) (*time.Time, error) {
t := obj.Time()
return &t, nil
}
+var _ graph.EditCommentOperationResolver = editCommentOperationResolver{}
+
type editCommentOperationResolver struct{}
+func (editCommentOperationResolver) ID(ctx context.Context, obj *bug.EditCommentOperation) (string, error) {
+ return obj.Id().String(), nil
+}
+
+func (editCommentOperationResolver) Target(ctx context.Context, obj *bug.EditCommentOperation) (string, error) {
+ panic("implement me")
+}
+
func (editCommentOperationResolver) Date(ctx context.Context, obj *bug.EditCommentOperation) (*time.Time, error) {
t := obj.Time()
return &t, nil
}
-type labelChangeOperation struct{}
+var _ graph.LabelChangeOperationResolver = labelChangeOperationResolver{}
+
+type labelChangeOperationResolver struct{}
-func (labelChangeOperation) Date(ctx context.Context, obj *bug.LabelChangeOperation) (*time.Time, error) {
+func (labelChangeOperationResolver) ID(ctx context.Context, obj *bug.LabelChangeOperation) (string, error) {
+ return obj.Id().String(), nil
+}
+
+func (labelChangeOperationResolver) Date(ctx context.Context, obj *bug.LabelChangeOperation) (*time.Time, error) {
t := obj.Time()
return &t, nil
}
+var _ graph.SetStatusOperationResolver = setStatusOperationResolver{}
+
type setStatusOperationResolver struct{}
+func (setStatusOperationResolver) ID(ctx context.Context, obj *bug.SetStatusOperation) (string, error) {
+ return obj.Id().String(), nil
+}
+
func (setStatusOperationResolver) Date(ctx context.Context, obj *bug.SetStatusOperation) (*time.Time, error) {
t := obj.Time()
return &t, nil
@@ -48,8 +83,14 @@ func (setStatusOperationResolver) Status(ctx context.Context, obj *bug.SetStatus
return convertStatus(obj.Status)
}
+var _ graph.SetTitleOperationResolver = setTitleOperationResolver{}
+
type setTitleOperationResolver struct{}
+func (setTitleOperationResolver) ID(ctx context.Context, obj *bug.SetTitleOperation) (string, error) {
+ return obj.Id().String(), nil
+}
+
func (setTitleOperationResolver) Date(ctx context.Context, obj *bug.SetTitleOperation) (*time.Time, error) {
t := obj.Time()
return &t, nil
diff --git a/graphql/resolvers/repo.go b/graphql/resolvers/repo.go
index 68a3ce0a..ac9c162f 100644
--- a/graphql/resolvers/repo.go
+++ b/graphql/resolvers/repo.go
@@ -5,6 +5,7 @@ import (
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/graphql/connections"
"github.com/MichaelMure/git-bug/graphql/graph"
"github.com/MichaelMure/git-bug/graphql/models"
@@ -38,7 +39,7 @@ func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after *
source := obj.Repo.QueryBugs(query)
// The edger create a custom edge holding just the id
- edger := func(id string, offset int) connections.Edge {
+ edger := func(id entity.Id, offset int) connections.Edge {
return connections.LazyBugEdge{
Id: id,
Cursor: connections.OffsetToCursor(offset),
@@ -46,7 +47,7 @@ func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after *
}
// The conMaker will finally load and compile bugs from git to replace the selected edges
- conMaker := func(lazyBugEdges []*connections.LazyBugEdge, lazyNode []string, info *models.PageInfo, totalCount int) (*models.BugConnection, error) {
+ conMaker := func(lazyBugEdges []*connections.LazyBugEdge, lazyNode []entity.Id, info *models.PageInfo, totalCount int) (*models.BugConnection, error) {
edges := make([]*models.BugEdge, len(lazyBugEdges))
nodes := make([]*bug.Snapshot, len(lazyBugEdges))
@@ -99,7 +100,7 @@ func (repoResolver) AllIdentities(ctx context.Context, obj *models.Repository, a
source := obj.Repo.AllIdentityIds()
// The edger create a custom edge holding just the id
- edger := func(id string, offset int) connections.Edge {
+ edger := func(id entity.Id, offset int) connections.Edge {
return connections.LazyIdentityEdge{
Id: id,
Cursor: connections.OffsetToCursor(offset),
@@ -107,7 +108,7 @@ func (repoResolver) AllIdentities(ctx context.Context, obj *models.Repository, a
}
// The conMaker will finally load and compile identities from git to replace the selected edges
- conMaker := func(lazyIdentityEdges []*connections.LazyIdentityEdge, lazyNode []string, info *models.PageInfo, totalCount int) (*models.IdentityConnection, error) {
+ conMaker := func(lazyIdentityEdges []*connections.LazyIdentityEdge, lazyNode []entity.Id, info *models.PageInfo, totalCount int) (*models.IdentityConnection, error) {
edges := make([]*models.IdentityEdge, len(lazyIdentityEdges))
nodes := make([]identity.Interface, len(lazyIdentityEdges))
diff --git a/graphql/resolvers/root.go b/graphql/resolvers/root.go
index 8873b723..3b129f3b 100644
--- a/graphql/resolvers/root.go
+++ b/graphql/resolvers/root.go
@@ -87,7 +87,7 @@ func (r RootResolver) EditCommentOperation() graph.EditCommentOperationResolver
}
func (RootResolver) LabelChangeOperation() graph.LabelChangeOperationResolver {
- return &labelChangeOperation{}
+ return &labelChangeOperationResolver{}
}
func (RootResolver) SetStatusOperation() graph.SetStatusOperationResolver {
diff --git a/graphql/resolvers/timeline.go b/graphql/resolvers/timeline.go
index 27f799ba..b206f898 100644
--- a/graphql/resolvers/timeline.go
+++ b/graphql/resolvers/timeline.go
@@ -5,9 +5,12 @@ import (
"time"
"github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/graphql/graph"
"github.com/MichaelMure/git-bug/graphql/models"
)
+var _ graph.CommentHistoryStepResolver = commentHistoryStepResolver{}
+
type commentHistoryStepResolver struct{}
func (commentHistoryStepResolver) Date(ctx context.Context, obj *bug.CommentHistoryStep) (*time.Time, error) {
@@ -15,8 +18,14 @@ func (commentHistoryStepResolver) Date(ctx context.Context, obj *bug.CommentHist
return &t, nil
}
+var _ graph.AddCommentTimelineItemResolver = addCommentTimelineItemResolver{}
+
type addCommentTimelineItemResolver struct{}
+func (addCommentTimelineItemResolver) ID(ctx context.Context, obj *bug.AddCommentTimelineItem) (string, error) {
+ return obj.Id().String(), nil
+}
+
func (addCommentTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) {
t := obj.CreatedAt.Time()
return &t, nil
@@ -27,8 +36,14 @@ func (addCommentTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.Add
return &t, nil
}
+var _ graph.CreateTimelineItemResolver = createTimelineItemResolver{}
+
type createTimelineItemResolver struct{}
+func (createTimelineItemResolver) ID(ctx context.Context, obj *bug.CreateTimelineItem) (string, error) {
+ return obj.Id().String(), nil
+}
+
func (createTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) {
t := obj.CreatedAt.Time()
return &t, nil
@@ -39,15 +54,27 @@ func (createTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.CreateT
return &t, nil
}
+var _ graph.LabelChangeTimelineItemResolver = labelChangeTimelineItem{}
+
type labelChangeTimelineItem struct{}
+func (labelChangeTimelineItem) ID(ctx context.Context, obj *bug.LabelChangeTimelineItem) (string, error) {
+ return obj.Id().String(), nil
+}
+
func (labelChangeTimelineItem) Date(ctx context.Context, obj *bug.LabelChangeTimelineItem) (*time.Time, error) {
t := obj.UnixTime.Time()
return &t, nil
}
+var _ graph.SetStatusTimelineItemResolver = setStatusTimelineItem{}
+
type setStatusTimelineItem struct{}
+func (setStatusTimelineItem) ID(ctx context.Context, obj *bug.SetStatusTimelineItem) (string, error) {
+ return obj.Id().String(), nil
+}
+
func (setStatusTimelineItem) Date(ctx context.Context, obj *bug.SetStatusTimelineItem) (*time.Time, error) {
t := obj.UnixTime.Time()
return &t, nil
@@ -57,8 +84,14 @@ func (setStatusTimelineItem) Status(ctx context.Context, obj *bug.SetStatusTimel
return convertStatus(obj.Status)
}
+var _ graph.SetTitleTimelineItemResolver = setTitleTimelineItem{}
+
type setTitleTimelineItem struct{}
+func (setTitleTimelineItem) ID(ctx context.Context, obj *bug.SetTitleTimelineItem) (string, error) {
+ return obj.Id().String(), nil
+}
+
func (setTitleTimelineItem) Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (*time.Time, error) {
t := obj.UnixTime.Time()
return &t, nil