github.com/opiuman/genqlient@v1.0.0/generate/testdata/snapshots/TestGenerateWithConfig-OptionalValue-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  )
    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  func ListInputQuery(
    81  	ctx context.Context,
    82  	client graphql.Client,
    83  	names []string,
    84  ) (*ListInputQueryResponse, error) {
    85  	req := &graphql.Request{
    86  		OpName: "ListInputQuery",
    87  		Query: `
    88  query ListInputQuery ($names: [String]) {
    89  	user(query: {names:$names}) {
    90  		id
    91  	}
    92  }
    93  `,
    94  		Variables: &__ListInputQueryInput{
    95  			Names: names,
    96  		},
    97  	}
    98  	var err error
    99  
   100  	var data ListInputQueryResponse
   101  	resp := &graphql.Response{Data: &data}
   102  
   103  	err = client.MakeRequest(
   104  		ctx,
   105  		req,
   106  		resp,
   107  	)
   108  
   109  	return &data, err
   110  }
   111  
   112  func QueryWithSlices(
   113  	ctx context.Context,
   114  	client graphql.Client,
   115  ) (*QueryWithSlicesResponse, error) {
   116  	req := &graphql.Request{
   117  		OpName: "QueryWithSlices",
   118  		Query: `
   119  query QueryWithSlices {
   120  	user {
   121  		emails
   122  		emailsOrNull
   123  		emailsWithNulls
   124  		emailsWithNullsOrNull
   125  	}
   126  }
   127  `,
   128  	}
   129  	var err error
   130  
   131  	var data QueryWithSlicesResponse
   132  	resp := &graphql.Response{Data: &data}
   133  
   134  	err = client.MakeRequest(
   135  		ctx,
   136  		req,
   137  		resp,
   138  	)
   139  
   140  	return &data, err
   141  }
   142