github.com/luciferinlove/gqlgen@v0.17.16-bzc.1/codegen/testserver/followschema/models-gen.go (about) 1 // Code generated by github.com/luciferinlove/gqlgen, DO NOT EDIT. 2 3 package followschema 4 5 import ( 6 "fmt" 7 "io" 8 "strconv" 9 "time" 10 ) 11 12 type Animal interface { 13 IsAnimal() 14 GetSpecies() string 15 } 16 17 type ContentChild interface { 18 IsContentChild() 19 } 20 21 type TestUnion interface { 22 IsTestUnion() 23 } 24 25 type A struct { 26 ID string `json:"id"` 27 } 28 29 func (A) IsTestUnion() {} 30 31 type AIt struct { 32 ID string `json:"id"` 33 } 34 35 type AbIt struct { 36 ID string `json:"id"` 37 } 38 39 type B struct { 40 ID string `json:"id"` 41 } 42 43 func (B) IsTestUnion() {} 44 45 type Cat struct { 46 Species string `json:"species"` 47 CatBreed string `json:"catBreed"` 48 } 49 50 func (Cat) IsAnimal() {} 51 func (this Cat) GetSpecies() string { return this.Species } 52 53 type CheckIssue896 struct { 54 ID *int `json:"id"` 55 } 56 57 type ContentPost struct { 58 Foo *string `json:"foo"` 59 } 60 61 func (ContentPost) IsContentChild() {} 62 63 type ContentUser struct { 64 Foo *string `json:"foo"` 65 } 66 67 func (ContentUser) IsContentChild() {} 68 69 type Coordinates struct { 70 X float64 `json:"x"` 71 Y float64 `json:"y"` 72 } 73 74 type DefaultInput struct { 75 FalsyBoolean *bool `json:"falsyBoolean"` 76 TruthyBoolean *bool `json:"truthyBoolean"` 77 } 78 79 type DefaultParametersMirror struct { 80 FalsyBoolean *bool `json:"falsyBoolean"` 81 TruthyBoolean *bool `json:"truthyBoolean"` 82 } 83 84 type Dog struct { 85 Species string `json:"species"` 86 DogBreed string `json:"dogBreed"` 87 } 88 89 func (Dog) IsAnimal() {} 90 func (this Dog) GetSpecies() string { return this.Species } 91 92 type EmbeddedDefaultScalar struct { 93 Value *string `json:"value"` 94 } 95 96 type FieldsOrderPayload struct { 97 FirstFieldValue *string `json:"firstFieldValue"` 98 } 99 100 type InnerDirectives struct { 101 Message string `json:"message"` 102 } 103 104 type InnerInput struct { 105 ID int `json:"id"` 106 } 107 108 type InnerObject struct { 109 ID int `json:"id"` 110 } 111 112 type InputDirectives struct { 113 Text string `json:"text"` 114 NullableText *string `json:"nullableText"` 115 Inner *InnerDirectives `json:"inner"` 116 InnerNullable *InnerDirectives `json:"innerNullable"` 117 ThirdParty *ThirdParty `json:"thirdParty"` 118 } 119 120 type InputWithEnumValue struct { 121 Enum EnumTest `json:"enum"` 122 } 123 124 type LoopA struct { 125 B *LoopB `json:"b"` 126 } 127 128 type LoopB struct { 129 A *LoopA `json:"a"` 130 } 131 132 // Since gqlgen defines default implementation for a Map scalar, this tests that the builtin is _not_ 133 // added to the TypeMap 134 type Map struct { 135 ID string `json:"id"` 136 } 137 138 type NestedInput struct { 139 Field Email `json:"field"` 140 } 141 142 type NestedMapInput struct { 143 Map map[string]interface{} `json:"map"` 144 } 145 146 type ObjectDirectives struct { 147 Text string `json:"text"` 148 NullableText *string `json:"nullableText"` 149 Order []string `json:"order"` 150 } 151 152 type OuterInput struct { 153 Inner *InnerInput `json:"inner"` 154 } 155 156 type OuterObject struct { 157 Inner *InnerObject `json:"inner"` 158 } 159 160 type Pet struct { 161 ID int `json:"id"` 162 Friends []*Pet `json:"friends"` 163 } 164 165 type Slices struct { 166 Test1 []*string `json:"test1"` 167 Test2 []string `json:"test2"` 168 Test3 []*string `json:"test3"` 169 Test4 []string `json:"test4"` 170 } 171 172 type SpecialInput struct { 173 Nesting *NestedInput `json:"nesting"` 174 } 175 176 type User struct { 177 ID int `json:"id"` 178 Friends []*User `json:"friends"` 179 Created time.Time `json:"created"` 180 Updated *time.Time `json:"updated"` 181 Pets []*Pet `json:"pets"` 182 } 183 184 type ValidInput struct { 185 Break string `json:"break"` 186 Default string `json:"default"` 187 Func string `json:"func"` 188 Interface string `json:"interface"` 189 Select string `json:"select"` 190 Case string `json:"case"` 191 Defer string `json:"defer"` 192 Go string `json:"go"` 193 Map string `json:"map"` 194 Struct string `json:"struct"` 195 Chan string `json:"chan"` 196 Else string `json:"else"` 197 Goto string `json:"goto"` 198 Package string `json:"package"` 199 Switch string `json:"switch"` 200 Const string `json:"const"` 201 Fallthrough string `json:"fallthrough"` 202 If string `json:"if"` 203 Range string `json:"range"` 204 Type string `json:"type"` 205 Continue string `json:"continue"` 206 For string `json:"for"` 207 Import string `json:"import"` 208 Return string `json:"return"` 209 Var string `json:"var"` 210 Underscore string `json:"_"` 211 } 212 213 // These things are all valid, but without care generate invalid go code 214 type ValidType struct { 215 DifferentCase string `json:"differentCase"` 216 DifferentCaseOld string `json:"different_case"` 217 ValidInputKeywords bool `json:"validInputKeywords"` 218 ValidArgs bool `json:"validArgs"` 219 } 220 221 type XXIt struct { 222 ID string `json:"id"` 223 } 224 225 type XxIt struct { 226 ID string `json:"id"` 227 } 228 229 type AsdfIt struct { 230 ID string `json:"id"` 231 } 232 233 type IIt struct { 234 ID string `json:"id"` 235 } 236 237 type EnumTest string 238 239 const ( 240 EnumTestOk EnumTest = "OK" 241 EnumTestNg EnumTest = "NG" 242 ) 243 244 var AllEnumTest = []EnumTest{ 245 EnumTestOk, 246 EnumTestNg, 247 } 248 249 func (e EnumTest) IsValid() bool { 250 switch e { 251 case EnumTestOk, EnumTestNg: 252 return true 253 } 254 return false 255 } 256 257 func (e EnumTest) String() string { 258 return string(e) 259 } 260 261 func (e *EnumTest) UnmarshalGQL(v interface{}) error { 262 str, ok := v.(string) 263 if !ok { 264 return fmt.Errorf("enums must be strings") 265 } 266 267 *e = EnumTest(str) 268 if !e.IsValid() { 269 return fmt.Errorf("%s is not a valid EnumTest", str) 270 } 271 return nil 272 } 273 274 func (e EnumTest) MarshalGQL(w io.Writer) { 275 fmt.Fprint(w, strconv.Quote(e.String())) 276 } 277 278 type Status string 279 280 const ( 281 StatusOk Status = "OK" 282 StatusError Status = "ERROR" 283 ) 284 285 var AllStatus = []Status{ 286 StatusOk, 287 StatusError, 288 } 289 290 func (e Status) IsValid() bool { 291 switch e { 292 case StatusOk, StatusError: 293 return true 294 } 295 return false 296 } 297 298 func (e Status) String() string { 299 return string(e) 300 } 301 302 func (e *Status) UnmarshalGQL(v interface{}) error { 303 str, ok := v.(string) 304 if !ok { 305 return fmt.Errorf("enums must be strings") 306 } 307 308 *e = Status(str) 309 if !e.IsValid() { 310 return fmt.Errorf("%s is not a valid Status", str) 311 } 312 return nil 313 } 314 315 func (e Status) MarshalGQL(w io.Writer) { 316 fmt.Fprint(w, strconv.Quote(e.String())) 317 }