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