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	"github.com/MichaelMure/git-bug/identity"
 12)
 13
 14// An object that has an author.
 15type Authored interface {
 16	IsAuthored()
 17}
 18
 19// The connection type for Bug.
 20type BugConnection struct {
 21	// A list of edges.
 22	Edges []BugEdge      `json:"edges"`
 23	Nodes []bug.Snapshot `json:"nodes"`
 24	// Information to aid in pagination.
 25	PageInfo PageInfo `json:"pageInfo"`
 26	// Identifies the total count of items in the connection.
 27	TotalCount int `json:"totalCount"`
 28}
 29
 30// An edge in a connection.
 31type BugEdge struct {
 32	// A cursor for use in pagination.
 33	Cursor string `json:"cursor"`
 34	// The item at the end of the edge.
 35	Node bug.Snapshot `json:"node"`
 36}
 37
 38type CommentConnection struct {
 39	Edges      []CommentEdge `json:"edges"`
 40	Nodes      []bug.Comment `json:"nodes"`
 41	PageInfo   PageInfo      `json:"pageInfo"`
 42	TotalCount int           `json:"totalCount"`
 43}
 44
 45type CommentEdge struct {
 46	Cursor string      `json:"cursor"`
 47	Node   bug.Comment `json:"node"`
 48}
 49
 50type IdentityConnection struct {
 51	Edges      []IdentityEdge       `json:"edges"`
 52	Nodes      []identity.Interface `json:"nodes"`
 53	PageInfo   PageInfo             `json:"pageInfo"`
 54	TotalCount int                  `json:"totalCount"`
 55}
 56
 57type IdentityEdge struct {
 58	Cursor string             `json:"cursor"`
 59	Node   identity.Interface `json:"node"`
 60}
 61
 62// The connection type for an Operation
 63type OperationConnection struct {
 64	Edges      []OperationEdge `json:"edges"`
 65	Nodes      []bug.Operation `json:"nodes"`
 66	PageInfo   PageInfo        `json:"pageInfo"`
 67	TotalCount int             `json:"totalCount"`
 68}
 69
 70// Represent an Operation
 71type OperationEdge struct {
 72	Cursor string        `json:"cursor"`
 73	Node   bug.Operation `json:"node"`
 74}
 75
 76// Information about pagination in a connection.
 77type PageInfo struct {
 78	// When paginating forwards, are there more items?
 79	HasNextPage bool `json:"hasNextPage"`
 80	// When paginating backwards, are there more items?
 81	HasPreviousPage bool `json:"hasPreviousPage"`
 82	// When paginating backwards, the cursor to continue.
 83	StartCursor string `json:"startCursor"`
 84	// When paginating forwards, the cursor to continue.
 85	EndCursor string `json:"endCursor"`
 86}
 87
 88// The connection type for TimelineItem
 89type TimelineItemConnection struct {
 90	Edges      []TimelineItemEdge `json:"edges"`
 91	Nodes      []bug.TimelineItem `json:"nodes"`
 92	PageInfo   PageInfo           `json:"pageInfo"`
 93	TotalCount int                `json:"totalCount"`
 94}
 95
 96// Represent a TimelineItem
 97type TimelineItemEdge struct {
 98	Cursor string           `json:"cursor"`
 99	Node   bug.TimelineItem `json:"node"`
100}
101
102type Status string
103
104const (
105	StatusOpen   Status = "OPEN"
106	StatusClosed Status = "CLOSED"
107)
108
109var AllStatus = []Status{
110	StatusOpen,
111	StatusClosed,
112}
113
114func (e Status) IsValid() bool {
115	switch e {
116	case StatusOpen, StatusClosed:
117		return true
118	}
119	return false
120}
121
122func (e Status) String() string {
123	return string(e)
124}
125
126func (e *Status) UnmarshalGQL(v interface{}) error {
127	str, ok := v.(string)
128	if !ok {
129		return fmt.Errorf("enums must be strings")
130	}
131
132	*e = Status(str)
133	if !e.IsValid() {
134		return fmt.Errorf("%s is not a valid Status", str)
135	}
136	return nil
137}
138
139func (e Status) MarshalGQL(w io.Writer) {
140	fmt.Fprint(w, strconv.Quote(e.String()))
141}