diff options
author | Michael Muré <batolettre@gmail.com> | 2019-05-15 18:20:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-15 18:20:54 +0200 |
commit | 22f435bd2a8fc35bde96eafb50b3f78650a5983b (patch) | |
tree | 629b72f3d95ac7b7806fb83096a3b89e14f745ef /graphql/connections/connection_template.go | |
parent | 97476ff5fadaf0a457d0f0133db58415b6075940 (diff) | |
parent | 8bab279114f06f10e22435b0caf9002201831555 (diff) | |
download | git-bug-22f435bd2a8fc35bde96eafb50b3f78650a5983b.tar.gz |
Merge pull request #134 from A-Hilaly/gqlgen
Upgrade gqlgen version to v0.9.0
Diffstat (limited to 'graphql/connections/connection_template.go')
-rw-r--r-- | graphql/connections/connection_template.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/graphql/connections/connection_template.go b/graphql/connections/connection_template.go index 4370957c..f276b2d0 100644 --- a/graphql/connections/connection_template.go +++ b/graphql/connections/connection_template.go @@ -26,17 +26,17 @@ type NameEdgeMaker func(value NodeType, offset int) Edge // NameConMaker define a function that create a ConnectionType type NameConMaker func( - edges []EdgeType, + edges []*EdgeType, nodes []NodeType, - info models.PageInfo, + info *models.PageInfo, totalCount int) (*ConnectionType, error) // NameCon will paginate a source according to the input of a relay connection func NameCon(source []NodeType, edgeMaker NameEdgeMaker, conMaker NameConMaker, input models.ConnectionInput) (*ConnectionType, error) { var nodes []NodeType - var edges []EdgeType + var edges []*EdgeType var cursors []string - var pageInfo models.PageInfo + var pageInfo = &models.PageInfo{} var totalCount = len(source) emptyCon, _ := conMaker(edges, nodes, pageInfo, 0) @@ -66,18 +66,20 @@ func NameCon(source []NodeType, edgeMaker NameEdgeMaker, conMaker NameConMaker, break } - edges = append(edges, edge.(EdgeType)) + e := edge.(EdgeType) + edges = append(edges, &e) cursors = append(cursors, edge.GetCursor()) nodes = append(nodes, value) } } else { - edges = make([]EdgeType, len(source)) + edges = make([]*EdgeType, len(source)) cursors = make([]string, len(source)) nodes = source for i, value := range source { edge := edgeMaker(value, i+offset) - edges[i] = edge.(EdgeType) + e := edge.(EdgeType) + edges[i] = &e cursors[i] = edge.GetCursor() } } |