gen_models.go

 1// Code generated by github.com/99designs/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
13// An object that has an author.
14type Authored interface{}
15
16// The connection type for Bug.
17type BugConnection struct {
18	Edges      []BugEdge      `json:"edges"`
19	Nodes      []bug.Snapshot `json:"nodes"`
20	PageInfo   PageInfo       `json:"pageInfo"`
21	TotalCount int            `json:"totalCount"`
22}
23
24// An edge in a connection.
25type BugEdge struct {
26	Cursor string       `json:"cursor"`
27	Node   bug.Snapshot `json:"node"`
28}
29
30type CommentConnection struct {
31	Edges      []CommentEdge `json:"edges"`
32	Nodes      []bug.Comment `json:"nodes"`
33	PageInfo   PageInfo      `json:"pageInfo"`
34	TotalCount int           `json:"totalCount"`
35}
36
37type CommentEdge struct {
38	Cursor string      `json:"cursor"`
39	Node   bug.Comment `json:"node"`
40}
41
42type OperationConnection struct {
43	Edges      []OperationEdge `json:"edges"`
44	Nodes      []bug.Operation `json:"nodes"`
45	PageInfo   PageInfo        `json:"pageInfo"`
46	TotalCount int             `json:"totalCount"`
47}
48
49type OperationEdge struct {
50	Cursor string        `json:"cursor"`
51	Node   bug.Operation `json:"node"`
52}
53
54// Information about pagination in a connection.
55type PageInfo struct {
56	HasNextPage     bool   `json:"hasNextPage"`
57	HasPreviousPage bool   `json:"hasPreviousPage"`
58	StartCursor     string `json:"startCursor"`
59	EndCursor       string `json:"endCursor"`
60}
61
62type Status string
63
64const (
65	StatusOpen   Status = "OPEN"
66	StatusClosed Status = "CLOSED"
67)
68
69func (e Status) IsValid() bool {
70	switch e {
71	case StatusOpen, StatusClosed:
72		return true
73	}
74	return false
75}
76
77func (e Status) String() string {
78	return string(e)
79}
80
81func (e *Status) UnmarshalGQL(v interface{}) error {
82	str, ok := v.(string)
83	if !ok {
84		return fmt.Errorf("enums must be strings")
85	}
86
87	*e = Status(str)
88	if !e.IsValid() {
89		return fmt.Errorf("%s is not a valid Status", str)
90	}
91	return nil
92}
93
94func (e Status) MarshalGQL(w io.Writer) {
95	fmt.Fprint(w, strconv.Quote(e.String()))
96}