diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-29 18:11:33 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-29 18:51:56 +0200 |
commit | 6363518c85cbd8247a5f6507b8a1dd3903cfb71d (patch) | |
tree | aa51652e9881196b3637247988cbd5155f42b5e2 /graphql2/resolvers/generated_model.go | |
parent | ff2fd14e3f10a7206d4ec86f07e524cfa290e0fc (diff) | |
download | git-bug-6363518c85cbd8247a5f6507b8a1dd3903cfb71d.tar.gz |
relay connection working with gqlgen
Diffstat (limited to 'graphql2/resolvers/generated_model.go')
-rw-r--r-- | graphql2/resolvers/generated_model.go | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/graphql2/resolvers/generated_model.go b/graphql2/resolvers/generated_model.go new file mode 100644 index 00000000..f6d78471 --- /dev/null +++ b/graphql2/resolvers/generated_model.go @@ -0,0 +1,88 @@ +// Code generated by github.com/vektah/gqlgen, DO NOT EDIT. + +package resolvers + +import ( + fmt "fmt" + io "io" + strconv "strconv" + + bug "github.com/MichaelMure/git-bug/bug" +) + +type Authored interface{} +type BugConnection struct { + Edges []*BugEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} +type BugEdge struct { + Cursor string `json:"cursor"` + Node bug.Snapshot `json:"node"` +} +type CommentConnection struct { + Edges []CommentEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} +type CommentEdge struct { + Cursor string `json:"cursor"` + Node bug.Comment `json:"node"` +} +type ConnectionInput struct { + After *string `json:"after"` + Before *string `json:"before"` + First *int `json:"first"` + Last *int `json:"last"` +} +type Operation interface{} +type OperationConnection struct { + Edges []OperationEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` + TotalCount int `json:"totalCount"` +} +type OperationEdge struct { + Cursor string `json:"cursor"` + Node OperationUnion `json:"node"` +} +type OperationUnion interface{} +type PageInfo struct { + HasNextPage bool `json:"hasNextPage"` + HasPreviousPage bool `json:"hasPreviousPage"` +} + +type Status string + +const ( + StatusOpen Status = "OPEN" + StatusClosed Status = "CLOSED" +) + +func (e Status) IsValid() bool { + switch e { + case StatusOpen, StatusClosed: + return true + } + return false +} + +func (e Status) String() string { + return string(e) +} + +func (e *Status) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = Status(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Status", str) + } + return nil +} + +func (e Status) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} |