aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/connections/connection_template.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-13 15:28:16 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-13 15:28:47 +0200
commitdf144e727a858ed07e3c9328d91efe052c4781e1 (patch)
treebfbfeea70f97ab3d4274c8e5add2c3aeeac1423b /graphql/connections/connection_template.go
parentf2f779c5a8b4efe67317bbffe110a9880c1f529a (diff)
downloadgit-bug-df144e727a858ed07e3c9328d91efe052c4781e1.tar.gz
fix some linting trouble
Diffstat (limited to 'graphql/connections/connection_template.go')
-rw-r--r--graphql/connections/connection_template.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/graphql/connections/connection_template.go b/graphql/connections/connection_template.go
index a4608430..511f48d3 100644
--- a/graphql/connections/connection_template.go
+++ b/graphql/connections/connection_template.go
@@ -2,22 +2,32 @@ package connections
import (
"fmt"
+
"github.com/MichaelMure/git-bug/graphql/models"
"github.com/cheekybits/genny/generic"
)
+// NodeType define the node type handled by this relay connection
type NodeType generic.Type
+
+// EdgeType define the edge type handled by this relay connection
type EdgeType generic.Type
+
+// ConnectionType define the connection type handled by this relay connection
type ConnectionType generic.Type
+// NodeTypeEdger define a function that take a NodeType and an offset and
+// create an Edge.
type NodeTypeEdger func(value NodeType, offset int) Edge
+// NodeTypeConMaker define a function that create a ConnectionType
type NodeTypeConMaker func(
edges []EdgeType,
nodes []NodeType,
info models.PageInfo,
totalCount int) (ConnectionType, error)
+// NodeTypeCon will paginate a source according to the input of a relay connection
func NodeTypeCon(source []NodeType, edger NodeTypeEdger, conMaker NodeTypeConMaker, input models.ConnectionInput) (ConnectionType, error) {
var nodes []NodeType
var edges []EdgeType