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 TimelineItemConnection struct {
 63	Edges      []TimelineItemEdge `json:"edges"`
 64	Nodes      []bug.TimelineItem `json:"nodes"`
 65	PageInfo   PageInfo           `json:"pageInfo"`
 66	TotalCount int                `json:"totalCount"`
 67}
 68
 69type TimelineItemEdge struct {
 70	Cursor string           `json:"cursor"`
 71	Node   bug.TimelineItem `json:"node"`
 72}
 73
 74type Status string
 75
 76const (
 77	StatusOpen   Status = "OPEN"
 78	StatusClosed Status = "CLOSED"
 79)
 80
 81func (e Status) IsValid() bool {
 82	switch e {
 83	case StatusOpen, StatusClosed:
 84		return true
 85	}
 86	return false
 87}
 88
 89func (e Status) String() string {
 90	return string(e)
 91}
 92
 93func (e *Status) UnmarshalGQL(v interface{}) error {
 94	str, ok := v.(string)
 95	if !ok {
 96		return fmt.Errorf("enums must be strings")
 97	}
 98
 99	*e = Status(str)
100	if !e.IsValid() {
101		return fmt.Errorf("%s is not a valid Status", str)
102	}
103	return nil
104}
105
106func (e Status) MarshalGQL(w io.Writer) {
107	fmt.Fprint(w, strconv.Quote(e.String()))
108}