github.com/codykaup/genqlient@v0.6.2/generate/testdata/snapshots/TestGenerateWithConfig-ExportOperations-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 ) 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 // The query or mutation executed by SimpleQuery. 38 const SimpleQuery_Operation = ` 39 query SimpleQuery { 40 user { 41 id 42 } 43 } 44 ` 45 46 func SimpleQuery( 47 ctx_ context.Context, 48 client_ graphql.Client, 49 ) (*SimpleQueryResponse, error) { 50 req_ := &graphql.Request{ 51 OpName: "SimpleQuery", 52 Query: SimpleQuery_Operation, 53 } 54 var err_ error 55 56 var data_ SimpleQueryResponse 57 resp_ := &graphql.Response{Data: &data_} 58 59 err_ = client_.MakeRequest( 60 ctx_, 61 req_, 62 resp_, 63 ) 64 65 return &data_, err_ 66 } 67