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	Edges      []BugEdge      `json:"edges"`
 22	Nodes      []bug.Snapshot `json:"nodes"`
 23	PageInfo   PageInfo       `json:"pageInfo"`
 24	TotalCount int            `json:"totalCount"`
 25}
 26
 27// An edge in a connection.
 28type BugEdge struct {
 29	Cursor string       `json:"cursor"`
 30	Node   bug.Snapshot `json:"node"`
 31}
 32
 33type CommentConnection struct {
 34	Edges      []CommentEdge `json:"edges"`
 35	Nodes      []bug.Comment `json:"nodes"`
 36	PageInfo   PageInfo      `json:"pageInfo"`
 37	TotalCount int           `json:"totalCount"`
 38}
 39
 40type CommentEdge struct {
 41	Cursor string      `json:"cursor"`
 42	Node   bug.Comment `json:"node"`
 43}
 44
 45type IdentityConnection struct {
 46	Edges      []IdentityEdge       `json:"edges"`
 47	Nodes      []identity.Interface `json:"nodes"`
 48	PageInfo   PageInfo             `json:"pageInfo"`
 49	TotalCount int                  `json:"totalCount"`
 50}
 51
 52type IdentityEdge struct {
 53	Cursor string             `json:"cursor"`
 54	Node   identity.Interface `json:"node"`
 55}
 56
 57// The connection type for an Operation
 58type OperationConnection struct {
 59	Edges      []OperationEdge `json:"edges"`
 60	Nodes      []bug.Operation `json:"nodes"`
 61	PageInfo   PageInfo        `json:"pageInfo"`
 62	TotalCount int             `json:"totalCount"`
 63}
 64
 65// Represent an Operation
 66type OperationEdge struct {
 67	Cursor string        `json:"cursor"`
 68	Node   bug.Operation `json:"node"`
 69}
 70
 71// Information about pagination in a connection.
 72type PageInfo struct {
 73	HasNextPage     bool   `json:"hasNextPage"`
 74	HasPreviousPage bool   `json:"hasPreviousPage"`
 75	StartCursor     string `json:"startCursor"`
 76	EndCursor       string `json:"endCursor"`
 77}
 78
 79// The connection type for TimelineItem
 80type TimelineItemConnection struct {
 81	Edges      []TimelineItemEdge `json:"edges"`
 82	Nodes      []bug.TimelineItem `json:"nodes"`
 83	PageInfo   PageInfo           `json:"pageInfo"`
 84	TotalCount int                `json:"totalCount"`
 85}
 86
 87// Represent a TimelineItem
 88type TimelineItemEdge struct {
 89	Cursor string           `json:"cursor"`
 90	Node   bug.TimelineItem `json:"node"`
 91}
 92
 93type Status string
 94
 95const (
 96	StatusOpen   Status = "OPEN"
 97	StatusClosed Status = "CLOSED"
 98)
 99
100func (e Status) IsValid() bool {
101	switch e {
102	case StatusOpen, StatusClosed:
103		return true
104	}
105	return false
106}
107
108func (e Status) String() string {
109	return string(e)
110}
111
112func (e *Status) UnmarshalGQL(v interface{}) error {
113	str, ok := v.(string)
114	if !ok {
115		return fmt.Errorf("enums must be strings")
116	}
117
118	*e = Status(str)
119	if !e.IsValid() {
120		return fmt.Errorf("%s is not a valid Status", str)
121	}
122	return nil
123}
124
125func (e Status) MarshalGQL(w io.Writer) {
126	fmt.Fprint(w, strconv.Quote(e.String()))
127}