github.com/operandinc/gqlgen@v0.16.1/integration/models-go/generated.go (about) 1 // Code generated by github.com/operandinc/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 ListCoercion struct { 18 EnumVal []*ErrorType `json:"enumVal"` 19 StrVal []*string `json:"strVal"` 20 IntVal []*int `json:"intVal"` 21 ScalarVal []map[string]interface{} `json:"scalarVal"` 22 } 23 24 type DateFilterOp string 25 26 const ( 27 DateFilterOpEq DateFilterOp = "EQ" 28 DateFilterOpNeq DateFilterOp = "NEQ" 29 DateFilterOpGt DateFilterOp = "GT" 30 DateFilterOpGte DateFilterOp = "GTE" 31 DateFilterOpLt DateFilterOp = "LT" 32 DateFilterOpLte DateFilterOp = "LTE" 33 ) 34 35 var AllDateFilterOp = []DateFilterOp{ 36 DateFilterOpEq, 37 DateFilterOpNeq, 38 DateFilterOpGt, 39 DateFilterOpGte, 40 DateFilterOpLt, 41 DateFilterOpLte, 42 } 43 44 func (e DateFilterOp) IsValid() bool { 45 switch e { 46 case DateFilterOpEq, DateFilterOpNeq, DateFilterOpGt, DateFilterOpGte, DateFilterOpLt, DateFilterOpLte: 47 return true 48 } 49 return false 50 } 51 52 func (e DateFilterOp) String() string { 53 return string(e) 54 } 55 56 func (e *DateFilterOp) UnmarshalGQL(v interface{}) error { 57 str, ok := v.(string) 58 if !ok { 59 return fmt.Errorf("enums must be strings") 60 } 61 62 *e = DateFilterOp(str) 63 if !e.IsValid() { 64 return fmt.Errorf("%s is not a valid DATE_FILTER_OP", str) 65 } 66 return nil 67 } 68 69 func (e DateFilterOp) MarshalGQL(w io.Writer) { 70 fmt.Fprint(w, strconv.Quote(e.String())) 71 } 72 73 type ErrorType string 74 75 const ( 76 ErrorTypeCustom ErrorType = "CUSTOM" 77 ErrorTypeNormal ErrorType = "NORMAL" 78 ) 79 80 var AllErrorType = []ErrorType{ 81 ErrorTypeCustom, 82 ErrorTypeNormal, 83 } 84 85 func (e ErrorType) IsValid() bool { 86 switch e { 87 case ErrorTypeCustom, ErrorTypeNormal: 88 return true 89 } 90 return false 91 } 92 93 func (e ErrorType) String() string { 94 return string(e) 95 } 96 97 func (e *ErrorType) UnmarshalGQL(v interface{}) error { 98 str, ok := v.(string) 99 if !ok { 100 return fmt.Errorf("enums must be strings") 101 } 102 103 *e = ErrorType(str) 104 if !e.IsValid() { 105 return fmt.Errorf("%s is not a valid ErrorType", str) 106 } 107 return nil 108 } 109 110 func (e ErrorType) MarshalGQL(w io.Writer) { 111 fmt.Fprint(w, strconv.Quote(e.String())) 112 }