aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/connections/gen_identity.go
diff options
context:
space:
mode:
Diffstat (limited to 'graphql/connections/gen_identity.go')
-rw-r--r--graphql/connections/gen_identity.go27
1 files changed, 14 insertions, 13 deletions
diff --git a/graphql/connections/gen_identity.go b/graphql/connections/gen_identity.go
index 28501171..2ba2f98f 100644
--- a/graphql/connections/gen_identity.go
+++ b/graphql/connections/gen_identity.go
@@ -8,23 +8,24 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/graphql/models"
+ "github.com/MichaelMure/git-bug/identity"
)
-// StringEdgeMaker define a function that take a string and an offset and
+// IdentityInterfaceEdgeMaker define a function that take a identity.Interface and an offset and
// create an Edge.
-type LazyIdentityEdgeMaker func(value string, offset int) Edge
+type IdentityEdgeMaker func(value identity.Interface, offset int) Edge
-// LazyIdentityConMaker define a function that create a models.IdentityConnection
-type LazyIdentityConMaker func(
- edges []LazyIdentityEdge,
- nodes []string,
+// IdentityConMaker define a function that create a models.IdentityConnection
+type IdentityConMaker func(
+ edges []models.IdentityEdge,
+ nodes []identity.Interface,
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
- var edges []LazyIdentityEdge
+// IdentityCon will paginate a source according to the input of a relay connection
+func IdentityCon(source []identity.Interface, edgeMaker IdentityEdgeMaker, conMaker IdentityConMaker, input models.ConnectionInput) (models.IdentityConnection, error) {
+ var nodes []identity.Interface
+ var edges []models.IdentityEdge
var cursors []string
var pageInfo models.PageInfo
var totalCount = len(source)
@@ -56,18 +57,18 @@ func LazyIdentityCon(source []string, edgeMaker LazyIdentityEdgeMaker, conMaker
break
}
- edges = append(edges, edge.(LazyIdentityEdge))
+ edges = append(edges, edge.(models.IdentityEdge))
cursors = append(cursors, edge.GetCursor())
nodes = append(nodes, value)
}
} else {
- edges = make([]LazyIdentityEdge, len(source))
+ edges = make([]models.IdentityEdge, len(source))
cursors = make([]string, len(source))
nodes = source
for i, value := range source {
edge := edgeMaker(value, i+offset)
- edges[i] = edge.(LazyIdentityEdge)
+ edges[i] = edge.(models.IdentityEdge)
cursors[i] = edge.GetCursor()
}
}