github.com/Desuuuu/genqlient@v0.5.3/generate/testdata/snapshots/TestGenerateWithConfig-StructReferences-testdata-queries-generated-structrefs.go (about) 1 // Code generated by github.com/Desuuuu/genqlient, DO NOT EDIT. 2 3 package queries 4 5 import ( 6 "context" 7 8 "github.com/Desuuuu/genqlient/graphql" 9 ) 10 11 // SimpleQueryResponse is returned by SimpleQuery on success. 12 type SimpleQueryResponse struct { 13 // user looks up a user by some stuff. 14 // 15 // See UserQueryInput for what stuff is supported. 16 // If query is null, returns the current user. 17 User *SimpleQueryUser `json:"user"` 18 } 19 20 // GetUser returns SimpleQueryResponse.User, and is useful for accessing the field via an interface. 21 func (v *SimpleQueryResponse) GetUser() *SimpleQueryUser { return v.User } 22 23 // SimpleQueryUser includes the requested fields of the GraphQL type User. 24 // The GraphQL type's documentation follows. 25 // 26 // A User is a user! 27 type SimpleQueryUser struct { 28 // id is the user's ID. 29 // 30 // It is stable, unique, and opaque, like all good IDs. 31 Id string `json:"id"` 32 } 33 34 // GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface. 35 func (v *SimpleQueryUser) GetId() string { return v.Id } 36 37 func SimpleQuery( 38 ctx context.Context, 39 client graphql.Client, 40 ) (*SimpleQueryResponse, error) { 41 req := &graphql.Request{ 42 OpName: "SimpleQuery", 43 Query: ` 44 query SimpleQuery { 45 user { 46 id 47 } 48 } 49 `, 50 } 51 var err error 52 53 var data SimpleQueryResponse 54 resp := &graphql.Response{Data: &data} 55 56 err = client.MakeRequest( 57 ctx, 58 req, 59 resp, 60 ) 61 62 return &data, err 63 } 64