github.com/codykaup/genqlient@v0.6.2/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetterCustomContext-testdata-queries-generated.go (about) 1 // Code generated by github.com/codykaup/genqlient, DO NOT EDIT. 2 3 package queries 4 5 import ( 6 "context" 7 8 "github.com/codykaup/genqlient/graphql" 9 "github.com/codykaup/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 // The query or mutation executed by SimpleQuery. 42 const SimpleQuery_Operation = ` 43 query SimpleQuery { 44 user { 45 id 46 } 47 } 48 ` 49 50 func SimpleQuery( 51 ctx_ testutil.MyContext, 52 ) (*SimpleQueryResponse, error) { 53 req_ := &graphql.Request{ 54 OpName: "SimpleQuery", 55 Query: SimpleQuery_Operation, 56 } 57 var err_ error 58 var client_ graphql.Client 59 60 client_, err_ = testutil.GetClientFromMyContext(ctx_) 61 if err_ != nil { 62 return nil, err_ 63 } 64 65 var data_ SimpleQueryResponse 66 resp_ := &graphql.Response{Data: &data_} 67 68 err_ = client_.MakeRequest( 69 ctx_, 70 req_, 71 resp_, 72 ) 73 74 return &data_, err_ 75 } 76