github.com/senomas/gqlgen@v0.17.11-0.20220626120754-9aee61b0716a/plugin/modelgen/out_struct_pointers/generated.go (about) 1 // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. 2 3 package out_struct_pointers 4 5 import ( 6 "fmt" 7 "io" 8 "strconv" 9 ) 10 11 type A interface { 12 IsA() 13 } 14 15 type B interface { 16 IsB() 17 } 18 19 type C interface { 20 A 21 IsC() 22 } 23 24 type D interface { 25 A 26 B 27 IsD() 28 } 29 30 type FooBarer interface { 31 IsFooBarer() 32 } 33 34 // InterfaceWithDescription is an interface with a description 35 type InterfaceWithDescription interface { 36 IsInterfaceWithDescription() 37 } 38 39 type MissingInterface interface { 40 IsMissingInterface() 41 } 42 43 type MissingUnion interface { 44 IsMissingUnion() 45 } 46 47 // UnionWithDescription is an union with a description 48 type UnionWithDescription interface { 49 IsUnionWithDescription() 50 } 51 52 type CDImplemented struct { 53 A string `json:"a" database:"CDImplementeda"` 54 B int `json:"b" database:"CDImplementedb"` 55 C bool `json:"c" database:"CDImplementedc"` 56 D *string `json:"d" database:"CDImplementedd"` 57 } 58 59 func (CDImplemented) IsC() {} 60 func (CDImplemented) IsA() {} 61 func (CDImplemented) IsD() {} 62 func (CDImplemented) IsB() {} 63 64 type CyclicalA struct { 65 FieldOne *CyclicalB `json:"field_one" database:"CyclicalAfield_one"` 66 FieldTwo *CyclicalB `json:"field_two" database:"CyclicalAfield_two"` 67 FieldThree *CyclicalB `json:"field_three" database:"CyclicalAfield_three"` 68 FieldFour string `json:"field_four" database:"CyclicalAfield_four"` 69 } 70 71 type CyclicalB struct { 72 FieldOne *CyclicalA `json:"field_one" database:"CyclicalBfield_one"` 73 FieldTwo *CyclicalA `json:"field_two" database:"CyclicalBfield_two"` 74 FieldThree *CyclicalA `json:"field_three" database:"CyclicalBfield_three"` 75 FieldFour *CyclicalA `json:"field_four" database:"CyclicalBfield_four"` 76 FieldFive string `json:"field_five" database:"CyclicalBfield_five"` 77 } 78 79 type FieldMutationHook struct { 80 Name *string `json:"name" anotherTag:"tag" database:"FieldMutationHookname"` 81 Enum *ExistingEnum `json:"enum" yetAnotherTag:"12" database:"FieldMutationHookenum"` 82 NoVal *string `json:"noVal" yaml:"noVal" repeated:"true" database:"FieldMutationHooknoVal"` 83 Repeated *string `json:"repeated" someTag:"value" repeated:"true" database:"FieldMutationHookrepeated"` 84 } 85 86 type MissingInput struct { 87 Name *string `json:"name" database:"MissingInputname"` 88 Enum *MissingEnum `json:"enum" database:"MissingInputenum"` 89 } 90 91 type MissingTypeNotNull struct { 92 Name string `json:"name" database:"MissingTypeNotNullname"` 93 Enum MissingEnum `json:"enum" database:"MissingTypeNotNullenum"` 94 Int MissingInterface `json:"int" database:"MissingTypeNotNullint"` 95 Existing ExistingType `json:"existing" database:"MissingTypeNotNullexisting"` 96 Missing2 MissingTypeNullable `json:"missing2" database:"MissingTypeNotNullmissing2"` 97 } 98 99 func (MissingTypeNotNull) IsMissingInterface() {} 100 func (MissingTypeNotNull) IsExistingInterface() {} 101 func (MissingTypeNotNull) IsMissingUnion() {} 102 func (MissingTypeNotNull) IsExistingUnion() {} 103 104 type MissingTypeNullable struct { 105 Name *string `json:"name" database:"MissingTypeNullablename"` 106 Enum *MissingEnum `json:"enum" database:"MissingTypeNullableenum"` 107 Int MissingInterface `json:"int" database:"MissingTypeNullableint"` 108 Existing *ExistingType `json:"existing" database:"MissingTypeNullableexisting"` 109 Missing2 *MissingTypeNotNull `json:"missing2" database:"MissingTypeNullablemissing2"` 110 } 111 112 func (MissingTypeNullable) IsMissingInterface() {} 113 func (MissingTypeNullable) IsExistingInterface() {} 114 func (MissingTypeNullable) IsMissingUnion() {} 115 func (MissingTypeNullable) IsExistingUnion() {} 116 117 type NotCyclicalA struct { 118 FieldOne string `json:"FieldOne" database:"NotCyclicalAFieldOne"` 119 FieldTwo int `json:"FieldTwo" database:"NotCyclicalAFieldTwo"` 120 } 121 122 type NotCyclicalB struct { 123 FieldOne string `json:"FieldOne" database:"NotCyclicalBFieldOne"` 124 FieldTwo NotCyclicalA `json:"FieldTwo" database:"NotCyclicalBFieldTwo"` 125 } 126 127 type Recursive struct { 128 FieldOne *Recursive `json:"FieldOne" database:"RecursiveFieldOne"` 129 FieldTwo *Recursive `json:"FieldTwo" database:"RecursiveFieldTwo"` 130 FieldThree *Recursive `json:"FieldThree" database:"RecursiveFieldThree"` 131 FieldFour string `json:"FieldFour" database:"RecursiveFieldFour"` 132 } 133 134 type RenameFieldTest struct { 135 BadName string `json:"badName" database:"RenameFieldTestbadName"` 136 OtherField string `json:"otherField" database:"RenameFieldTestotherField"` 137 } 138 139 // TypeWithDescription is a type with a description 140 type TypeWithDescription struct { 141 Name *string `json:"name" database:"TypeWithDescriptionname"` 142 } 143 144 func (TypeWithDescription) IsUnionWithDescription() {} 145 146 type FooBarr struct { 147 Name string `json:"name" database:"_Foo_Barrname"` 148 } 149 150 func (FooBarr) IsFooBarer() {} 151 152 // EnumWithDescription is an enum with a description 153 type EnumWithDescription string 154 155 const ( 156 EnumWithDescriptionCat EnumWithDescription = "CAT" 157 EnumWithDescriptionDog EnumWithDescription = "DOG" 158 ) 159 160 var AllEnumWithDescription = []EnumWithDescription{ 161 EnumWithDescriptionCat, 162 EnumWithDescriptionDog, 163 } 164 165 func (e EnumWithDescription) IsValid() bool { 166 switch e { 167 case EnumWithDescriptionCat, EnumWithDescriptionDog: 168 return true 169 } 170 return false 171 } 172 173 func (e EnumWithDescription) String() string { 174 return string(e) 175 } 176 177 func (e *EnumWithDescription) UnmarshalGQL(v interface{}) error { 178 str, ok := v.(string) 179 if !ok { 180 return fmt.Errorf("enums must be strings") 181 } 182 183 *e = EnumWithDescription(str) 184 if !e.IsValid() { 185 return fmt.Errorf("%s is not a valid EnumWithDescription", str) 186 } 187 return nil 188 } 189 190 func (e EnumWithDescription) MarshalGQL(w io.Writer) { 191 fmt.Fprint(w, strconv.Quote(e.String())) 192 } 193 194 type MissingEnum string 195 196 const ( 197 MissingEnumHello MissingEnum = "Hello" 198 MissingEnumGoodbye MissingEnum = "Goodbye" 199 ) 200 201 var AllMissingEnum = []MissingEnum{ 202 MissingEnumHello, 203 MissingEnumGoodbye, 204 } 205 206 func (e MissingEnum) IsValid() bool { 207 switch e { 208 case MissingEnumHello, MissingEnumGoodbye: 209 return true 210 } 211 return false 212 } 213 214 func (e MissingEnum) String() string { 215 return string(e) 216 } 217 218 func (e *MissingEnum) UnmarshalGQL(v interface{}) error { 219 str, ok := v.(string) 220 if !ok { 221 return fmt.Errorf("enums must be strings") 222 } 223 224 *e = MissingEnum(str) 225 if !e.IsValid() { 226 return fmt.Errorf("%s is not a valid MissingEnum", str) 227 } 228 return nil 229 } 230 231 func (e MissingEnum) MarshalGQL(w io.Writer) { 232 fmt.Fprint(w, strconv.Quote(e.String())) 233 }