gen_models.go

 1// Code generated by github.com/vektah/gqlgen, DO NOT EDIT.
 2
 3package models
 4
 5import (
 6	fmt "fmt"
 7	io "io"
 8	strconv "strconv"
 9
10	bug "github.com/MichaelMure/git-bug/bug"
11)
12
13type Authored interface{}
14type BugConnection struct {
15	Edges      []BugEdge      `json:"edges"`
16	Nodes      []bug.Snapshot `json:"nodes"`
17	PageInfo   PageInfo       `json:"pageInfo"`
18	TotalCount int            `json:"totalCount"`
19}
20type BugEdge struct {
21	Cursor string       `json:"cursor"`
22	Node   bug.Snapshot `json:"node"`
23}
24type CommentConnection struct {
25	Edges      []CommentEdge `json:"edges"`
26	Nodes      []bug.Comment `json:"nodes"`
27	PageInfo   PageInfo      `json:"pageInfo"`
28	TotalCount int           `json:"totalCount"`
29}
30type CommentEdge struct {
31	Cursor string      `json:"cursor"`
32	Node   bug.Comment `json:"node"`
33}
34type OperationConnection struct {
35	Edges      []OperationEdge `json:"edges"`
36	Nodes      []bug.Operation `json:"nodes"`
37	PageInfo   PageInfo        `json:"pageInfo"`
38	TotalCount int             `json:"totalCount"`
39}
40type OperationEdge struct {
41	Cursor string        `json:"cursor"`
42	Node   bug.Operation `json:"node"`
43}
44type PageInfo struct {
45	HasNextPage     bool   `json:"hasNextPage"`
46	HasPreviousPage bool   `json:"hasPreviousPage"`
47	StartCursor     string `json:"startCursor"`
48	EndCursor       string `json:"endCursor"`
49}
50
51type Status string
52
53const (
54	StatusOpen   Status = "OPEN"
55	StatusClosed Status = "CLOSED"
56)
57
58func (e Status) IsValid() bool {
59	switch e {
60	case StatusOpen, StatusClosed:
61		return true
62	}
63	return false
64}
65
66func (e Status) String() string {
67	return string(e)
68}
69
70func (e *Status) UnmarshalGQL(v interface{}) error {
71	str, ok := v.(string)
72	if !ok {
73		return fmt.Errorf("enums must be strings")
74	}
75
76	*e = Status(str)
77	if !e.IsValid() {
78		return fmt.Errorf("%s is not a valid Status", str)
79	}
80	return nil
81}
82
83func (e Status) MarshalGQL(w io.Writer) {
84	fmt.Fprint(w, strconv.Quote(e.String()))
85}