aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/connections/connection_template.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-29 20:58:22 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-29 20:58:22 +0200
commitc58aa18a2d0683b0a1e6f0597724e67b500503a0 (patch)
tree06b7611ebce2a4cbe0c99f72729517cb8114e3f1 /graphql/connections/connection_template.go
parent08f03ecf3cbbc350585acf0492966681ec449a94 (diff)
downloadgit-bug-c58aa18a2d0683b0a1e6f0597724e67b500503a0.tar.gz
graphql: lazy loading for the bug relay connection
Diffstat (limited to 'graphql/connections/connection_template.go')
-rw-r--r--graphql/connections/connection_template.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/graphql/connections/connection_template.go b/graphql/connections/connection_template.go
index 3dfaca8f..7f97c00b 100644
--- a/graphql/connections/connection_template.go
+++ b/graphql/connections/connection_template.go
@@ -11,13 +11,13 @@ type EdgeType generic.Type
type ConnectionType generic.Type
type NodeTypeEdger func(value NodeType, offset int) Edge
-type NodeTypeConMaker func(edges []EdgeType, info models.PageInfo, totalCount int) ConnectionType
+type NodeTypeConMaker func(edges []EdgeType, info models.PageInfo, totalCount int) (ConnectionType, error)
func NodeTypeCon(source []NodeType, edger NodeTypeEdger, conMaker NodeTypeConMaker, input models.ConnectionInput) (ConnectionType, error) {
var edges []EdgeType
var pageInfo models.PageInfo
- emptyCon := conMaker(edges, pageInfo, 0)
+ emptyCon, _ := conMaker(edges, pageInfo, 0)
offset := 0
@@ -76,7 +76,5 @@ func NodeTypeCon(source []NodeType, edger NodeTypeEdger, conMaker NodeTypeConMak
}
}
- con := conMaker(edges, pageInfo, len(source))
-
- return con, nil
+ return conMaker(edges, pageInfo, len(source))
}