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