github.com/humans-group/gqlgen@v0.7.2/integration/models-go/generated.go (about) 1 // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. 2 3 package models 4 5 import ( 6 "fmt" 7 "io" 8 "strconv" 9 ) 10 11 type DateFilter struct { 12 Value string `json:"value"` 13 Timezone *string `json:"timezone"` 14 Op *DateFilterOp `json:"op"` 15 } 16 17 type DateFilterOp string 18 19 const ( 20 DateFilterOpEq DateFilterOp = "EQ" 21 DateFilterOpNeq DateFilterOp = "NEQ" 22 DateFilterOpGt DateFilterOp = "GT" 23 DateFilterOpGte DateFilterOp = "GTE" 24 DateFilterOpLt DateFilterOp = "LT" 25 DateFilterOpLte DateFilterOp = "LTE" 26 ) 27 28 func (e DateFilterOp) IsValid() bool { 29 switch e { 30 case DateFilterOpEq, DateFilterOpNeq, DateFilterOpGt, DateFilterOpGte, DateFilterOpLt, DateFilterOpLte: 31 return true 32 } 33 return false 34 } 35 36 func (e DateFilterOp) String() string { 37 return string(e) 38 } 39 40 func (e *DateFilterOp) UnmarshalGQL(v interface{}) error { 41 str, ok := v.(string) 42 if !ok { 43 return fmt.Errorf("enums must be strings") 44 } 45 46 *e = DateFilterOp(str) 47 if !e.IsValid() { 48 return fmt.Errorf("%s is not a valid DATE_FILTER_OP", str) 49 } 50 return nil 51 } 52 53 func (e DateFilterOp) MarshalGQL(w io.Writer) { 54 fmt.Fprint(w, strconv.Quote(e.String())) 55 } 56 57 type ErrorType string 58 59 const ( 60 ErrorTypeCustom ErrorType = "CUSTOM" 61 ErrorTypeNormal ErrorType = "NORMAL" 62 ) 63 64 func (e ErrorType) IsValid() bool { 65 switch e { 66 case ErrorTypeCustom, ErrorTypeNormal: 67 return true 68 } 69 return false 70 } 71 72 func (e ErrorType) String() string { 73 return string(e) 74 } 75 76 func (e *ErrorType) UnmarshalGQL(v interface{}) error { 77 str, ok := v.(string) 78 if !ok { 79 return fmt.Errorf("enums must be strings") 80 } 81 82 *e = ErrorType(str) 83 if !e.IsValid() { 84 return fmt.Errorf("%s is not a valid ErrorType", str) 85 } 86 return nil 87 } 88 89 func (e ErrorType) MarshalGQL(w io.Writer) { 90 fmt.Fprint(w, strconv.Quote(e.String())) 91 }