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
 44type OperationConnection struct {
 45	Edges      []OperationEdge `json:"edges"`
 46	Nodes      []bug.Operation `json:"nodes"`
 47	PageInfo   PageInfo        `json:"pageInfo"`
 48	TotalCount int             `json:"totalCount"`
 49}
 50
 51type OperationEdge struct {
 52	Cursor string        `json:"cursor"`
 53	Node   bug.Operation `json:"node"`
 54}
 55
 56// Information about pagination in a connection.
 57type PageInfo struct {
 58	HasNextPage     bool   `json:"hasNextPage"`
 59	HasPreviousPage bool   `json:"hasPreviousPage"`
 60	StartCursor     string `json:"startCursor"`
 61	EndCursor       string `json:"endCursor"`
 62}
 63
 64type TimelineItemConnection struct {
 65	Edges      []TimelineItemEdge `json:"edges"`
 66	Nodes      []bug.TimelineItem `json:"nodes"`
 67	PageInfo   PageInfo           `json:"pageInfo"`
 68	TotalCount int                `json:"totalCount"`
 69}
 70
 71type TimelineItemEdge struct {
 72	Cursor string           `json:"cursor"`
 73	Node   bug.TimelineItem `json:"node"`
 74}
 75
 76type Status string
 77
 78const (
 79	StatusOpen   Status = "OPEN"
 80	StatusClosed Status = "CLOSED"
 81)
 82
 83func (e Status) IsValid() bool {
 84	switch e {
 85	case StatusOpen, StatusClosed:
 86		return true
 87	}
 88	return false
 89}
 90
 91func (e Status) String() string {
 92	return string(e)
 93}
 94
 95func (e *Status) UnmarshalGQL(v interface{}) error {
 96	str, ok := v.(string)
 97	if !ok {
 98		return fmt.Errorf("enums must be strings")
 99	}
100
101	*e = Status(str)
102	if !e.IsValid() {
103		return fmt.Errorf("%s is not a valid Status", str)
104	}
105	return nil
106}
107
108func (e Status) MarshalGQL(w io.Writer) {
109	fmt.Fprint(w, strconv.Quote(e.String()))
110}