github.com/codykaup/genqlient@v0.6.2/generate/testdata/snapshots/TestGenerateWithConfig-OptionalValue-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 // ListInputQueryResponse is returned by ListInputQuery on success. 12 type ListInputQueryResponse 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 ListInputQueryUser `json:"user"` 18 } 19 20 // GetUser returns ListInputQueryResponse.User, and is useful for accessing the field via an interface. 21 func (v *ListInputQueryResponse) GetUser() ListInputQueryUser { return v.User } 22 23 // ListInputQueryUser 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 ListInputQueryUser 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 ListInputQueryUser.Id, and is useful for accessing the field via an interface. 35 func (v *ListInputQueryUser) GetId() string { return v.Id } 36 37 // QueryWithSlicesResponse is returned by QueryWithSlices on success. 38 type QueryWithSlicesResponse struct { 39 // user looks up a user by some stuff. 40 // 41 // See UserQueryInput for what stuff is supported. 42 // If query is null, returns the current user. 43 User QueryWithSlicesUser `json:"user"` 44 } 45 46 // GetUser returns QueryWithSlicesResponse.User, and is useful for accessing the field via an interface. 47 func (v *QueryWithSlicesResponse) GetUser() QueryWithSlicesUser { return v.User } 48 49 // QueryWithSlicesUser includes the requested fields of the GraphQL type User. 50 // The GraphQL type's documentation follows. 51 // 52 // A User is a user! 53 type QueryWithSlicesUser struct { 54 Emails []string `json:"emails"` 55 EmailsOrNull []string `json:"emailsOrNull"` 56 EmailsWithNulls []string `json:"emailsWithNulls"` 57 EmailsWithNullsOrNull []string `json:"emailsWithNullsOrNull"` 58 } 59 60 // GetEmails returns QueryWithSlicesUser.Emails, and is useful for accessing the field via an interface. 61 func (v *QueryWithSlicesUser) GetEmails() []string { return v.Emails } 62 63 // GetEmailsOrNull returns QueryWithSlicesUser.EmailsOrNull, and is useful for accessing the field via an interface. 64 func (v *QueryWithSlicesUser) GetEmailsOrNull() []string { return v.EmailsOrNull } 65 66 // GetEmailsWithNulls returns QueryWithSlicesUser.EmailsWithNulls, and is useful for accessing the field via an interface. 67 func (v *QueryWithSlicesUser) GetEmailsWithNulls() []string { return v.EmailsWithNulls } 68 69 // GetEmailsWithNullsOrNull returns QueryWithSlicesUser.EmailsWithNullsOrNull, and is useful for accessing the field via an interface. 70 func (v *QueryWithSlicesUser) GetEmailsWithNullsOrNull() []string { return v.EmailsWithNullsOrNull } 71 72 // __ListInputQueryInput is used internally by genqlient 73 type __ListInputQueryInput struct { 74 Names []string `json:"names"` 75 } 76 77 // GetNames returns __ListInputQueryInput.Names, and is useful for accessing the field via an interface. 78 func (v *__ListInputQueryInput) GetNames() []string { return v.Names } 79 80 // The query or mutation executed by ListInputQuery. 81 const ListInputQuery_Operation = ` 82 query ListInputQuery ($names: [String]) { 83 user(query: {names:$names}) { 84 id 85 } 86 } 87 ` 88 89 func ListInputQuery( 90 ctx_ context.Context, 91 client_ graphql.Client, 92 names []string, 93 ) (*ListInputQueryResponse, error) { 94 req_ := &graphql.Request{ 95 OpName: "ListInputQuery", 96 Query: ListInputQuery_Operation, 97 Variables: &__ListInputQueryInput{ 98 Names: names, 99 }, 100 } 101 var err_ error 102 103 var data_ ListInputQueryResponse 104 resp_ := &graphql.Response{Data: &data_} 105 106 err_ = client_.MakeRequest( 107 ctx_, 108 req_, 109 resp_, 110 ) 111 112 return &data_, err_ 113 } 114 115 // The query or mutation executed by QueryWithSlices. 116 const QueryWithSlices_Operation = ` 117 query QueryWithSlices { 118 user { 119 emails 120 emailsOrNull 121 emailsWithNulls 122 emailsWithNullsOrNull 123 } 124 } 125 ` 126 127 func QueryWithSlices( 128 ctx_ context.Context, 129 client_ graphql.Client, 130 ) (*QueryWithSlicesResponse, error) { 131 req_ := &graphql.Request{ 132 OpName: "QueryWithSlices", 133 Query: QueryWithSlices_Operation, 134 } 135 var err_ error 136 137 var data_ QueryWithSlicesResponse 138 resp_ := &graphql.Response{Data: &data_} 139 140 err_ = client_.MakeRequest( 141 ctx_, 142 req_, 143 resp_, 144 ) 145 146 return &data_, err_ 147 } 148