aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/connections/gen_identity.go
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-05-15 16:57:30 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-05-15 16:57:30 +0200
commit8bab279114f06f10e22435b0caf9002201831555 (patch)
tree629b72f3d95ac7b7806fb83096a3b89e14f745ef /graphql/connections/gen_identity.go
parent6949d6c543e9397578c7c840812df9bbf8531528 (diff)
downloadgit-bug-8bab279114f06f10e22435b0caf9002201831555.tar.gz
Update graphql package to support gqlgen 0.9.0
Diffstat (limited to 'graphql/connections/gen_identity.go')
-rw-r--r--graphql/connections/gen_identity.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/graphql/connections/gen_identity.go b/graphql/connections/gen_identity.go
index 6c1e7137..b52b6f96 100644
--- a/graphql/connections/gen_identity.go
+++ b/graphql/connections/gen_identity.go
@@ -17,17 +17,17 @@ type IdentityEdgeMaker func(value identity.Interface, offset int) Edge
// IdentityConMaker define a function that create a models.IdentityConnection
type IdentityConMaker func(
- edges []models.IdentityEdge,
+ edges []*models.IdentityEdge,
nodes []identity.Interface,
- info models.PageInfo,
+ info *models.PageInfo,
totalCount int) (*models.IdentityConnection, error)
// 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 edges []*models.IdentityEdge
var cursors []string
- var pageInfo models.PageInfo
+ var pageInfo = &models.PageInfo{}
var totalCount = len(source)
emptyCon, _ := conMaker(edges, nodes, pageInfo, 0)
@@ -57,18 +57,20 @@ func IdentityCon(source []identity.Interface, edgeMaker IdentityEdgeMaker, conMa
break
}
- edges = append(edges, edge.(models.IdentityEdge))
+ e := edge.(models.IdentityEdge)
+ edges = append(edges, &e)
cursors = append(cursors, edge.GetCursor())
nodes = append(nodes, value)
}
} else {
- edges = make([]models.IdentityEdge, 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.(models.IdentityEdge)
+ e := edge.(models.IdentityEdge)
+ edges[i] = &e
cursors[i] = edge.GetCursor()
}
}