diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-16 13:50:53 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-16 13:50:53 +0200 |
commit | 6f5d433e33b5432887a8496074f0d7c7048c1167 (patch) | |
tree | dbde7ddd52cad8207c637012ceba839fd00c5fc9 /graphql | |
parent | b9fc8b662ed72844a93d1019b1ecf8b60464f78e (diff) | |
download | git-bug-6f5d433e33b5432887a8496074f0d7c7048c1167.tar.gz |
docs & cleaning
Diffstat (limited to 'graphql')
-rw-r--r-- | graphql/connections/connections.go | 1 | ||||
-rw-r--r-- | graphql/handler.go | 2 | ||||
-rw-r--r-- | graphql/models/models.go | 1 | ||||
-rw-r--r-- | graphql/relay.go | 37 | ||||
-rw-r--r-- | graphql/resolvers/root.go | 1 |
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 ( |