github.com/nathanstitt/genqlient@v0.3.1-0.20211028004951-a2bda3c41ab8/generate/testdata/snapshots/TestGenerate-SimpleMutation.graphql-SimpleMutation.graphql.go (about) 1 package test 2 3 // Code generated by github.com/Khan/genqlient, DO NOT EDIT. 4 5 import ( 6 "github.com/Khan/genqlient/graphql" 7 "github.com/Khan/genqlient/internal/testutil" 8 ) 9 10 // SimpleMutationCreateUser includes the requested fields of the GraphQL type User. 11 // The GraphQL type's documentation follows. 12 // 13 // A User is a user! 14 type SimpleMutationCreateUser struct { 15 // id is the user's ID. 16 // 17 // It is stable, unique, and opaque, like all good IDs. 18 Id testutil.ID `json:"id"` 19 Name string `json:"name"` 20 } 21 22 // GetId returns SimpleMutationCreateUser.Id, and is useful for accessing the field via an interface. 23 func (v *SimpleMutationCreateUser) GetId() testutil.ID { return v.Id } 24 25 // GetName returns SimpleMutationCreateUser.Name, and is useful for accessing the field via an interface. 26 func (v *SimpleMutationCreateUser) GetName() string { return v.Name } 27 28 // SimpleMutationResponse is returned by SimpleMutation on success. 29 type SimpleMutationResponse struct { 30 CreateUser SimpleMutationCreateUser `json:"createUser"` 31 } 32 33 // GetCreateUser returns SimpleMutationResponse.CreateUser, and is useful for accessing the field via an interface. 34 func (v *SimpleMutationResponse) GetCreateUser() SimpleMutationCreateUser { return v.CreateUser } 35 36 // __SimpleMutationInput is used internally by genqlient 37 type __SimpleMutationInput struct { 38 Name string `json:"name"` 39 } 40 41 // GetName returns __SimpleMutationInput.Name, and is useful for accessing the field via an interface. 42 func (v *__SimpleMutationInput) GetName() string { return v.Name } 43 44 // SimpleMutation creates a user. 45 // 46 // It has a long doc-comment, to test that we handle that correctly. 47 // What a long comment indeed. 48 func SimpleMutation( 49 client graphql.Client, 50 name string, 51 ) (*SimpleMutationResponse, error) { 52 __input := __SimpleMutationInput{ 53 Name: name, 54 } 55 var err error 56 57 var retval SimpleMutationResponse 58 err = client.MakeRequest( 59 nil, 60 "SimpleMutation", 61 ` 62 mutation SimpleMutation ($name: String!) { 63 createUser(name: $name) { 64 id 65 name 66 } 67 } 68 `, 69 &retval, 70 &__input, 71 ) 72 return &retval, err 73 } 74