gen_models.go

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