aboutsummaryrefslogtreecommitdiffstats
path: root/graphql
diff options
context:
space:
mode:
Diffstat (limited to 'graphql')
-rw-r--r--graphql/connections/connections.go1
-rw-r--r--graphql/handler.go2
-rw-r--r--graphql/models/models.go1
-rw-r--r--graphql/relay.go37
-rw-r--r--graphql/resolvers/root.go1
5 files changed, 5 insertions, 37 deletions
diff --git a/graphql/connections/connections.go b/graphql/connections/connections.go
index 8b905fab..de5b8f1a 100644
--- a/graphql/connections/connections.go
+++ b/graphql/connections/connections.go
@@ -2,6 +2,7 @@
//go:generate genny -in=connection_template.go -out=gen_operation.go gen "NodeType=bug.Operation EdgeType=models.OperationEdge ConnectionType=models.OperationConnection"
//go:generate genny -in=connection_template.go -out=gen_comment.go gen "NodeType=bug.Comment EdgeType=models.CommentEdge ConnectionType=models.CommentConnection"
+// Package connections implement a generic GraphQL relay connection
package connections
import (
diff --git a/graphql/handler.go b/graphql/handler.go
index 7b940d8f..ed5047c4 100644
--- a/graphql/handler.go
+++ b/graphql/handler.go
@@ -1,5 +1,6 @@
//go:generate go run gen_graphql.go
+// Package graphql contains the root GraphQL http handler
package graphql
import (
@@ -10,6 +11,7 @@ import (
"net/http"
)
+// Handler is the root GraphQL http handler
type Handler struct {
http.HandlerFunc
*resolvers.RootResolver
diff --git a/graphql/models/models.go b/graphql/models/models.go
index 63d9c1fe..816a04a8 100644
--- a/graphql/models/models.go
+++ b/graphql/models/models.go
@@ -1,3 +1,4 @@
+// Package models contains the various GraphQL data models
package models
import (
diff --git a/graphql/relay.go b/graphql/relay.go
deleted file mode 100644
index 036ab54e..00000000
--- a/graphql/relay.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package graphql
-
-import (
- "encoding/base64"
- "strings"
-)
-
-type ResolvedGlobalID struct {
- Type string `json:"type"`
- ID string `json:"id"`
-}
-
-// Takes a type name and an ID specific to that type name, and returns a
-// "global ID" that is unique among all types.
-func ToGlobalID(ttype string, id string) string {
- str := ttype + ":" + id
- encStr := base64.StdEncoding.EncodeToString([]byte(str))
- return encStr
-}
-
-// Takes the "global ID" created by toGlobalID, and returns the type name and ID
-// used to create it.
-func FromGlobalID(globalID string) *ResolvedGlobalID {
- strID := ""
- b, err := base64.StdEncoding.DecodeString(globalID)
- if err == nil {
- strID = string(b)
- }
- tokens := strings.Split(strID, ":")
- if len(tokens) < 2 {
- return nil
- }
- return &ResolvedGlobalID{
- Type: tokens[0],
- ID: tokens[1],
- }
-}
diff --git a/graphql/resolvers/root.go b/graphql/resolvers/root.go
index 1003f7f1..ff181784 100644
--- a/graphql/resolvers/root.go
+++ b/graphql/resolvers/root.go
@@ -1,3 +1,4 @@
+// Package resolvers contains the various GraphQL resolvers
package resolvers
import (