github.com/Desuuuu/genqlient@v0.5.3/generate/testdata/snapshots/TestGenerate-SimpleInput.graphql-SimpleInput.graphql.go (about)

     1  // Code generated by github.com/Desuuuu/genqlient, DO NOT EDIT.
     2  
     3  package test
     4  
     5  import (
     6  	"github.com/Desuuuu/genqlient/graphql"
     7  	"github.com/Desuuuu/genqlient/internal/testutil"
     8  )
     9  
    10  // SimpleInputQueryResponse is returned by SimpleInputQuery on success.
    11  type SimpleInputQueryResponse struct {
    12  	// user looks up a user by some stuff.
    13  	//
    14  	// See UserQueryInput for what stuff is supported.
    15  	// If query is null, returns the current user.
    16  	User SimpleInputQueryUser `json:"user"`
    17  }
    18  
    19  // GetUser returns SimpleInputQueryResponse.User, and is useful for accessing the field via an interface.
    20  func (v *SimpleInputQueryResponse) GetUser() SimpleInputQueryUser { return v.User }
    21  
    22  // SimpleInputQueryUser includes the requested fields of the GraphQL type User.
    23  // The GraphQL type's documentation follows.
    24  //
    25  // A User is a user!
    26  type SimpleInputQueryUser struct {
    27  	// id is the user's ID.
    28  	//
    29  	// It is stable, unique, and opaque, like all good IDs.
    30  	Id testutil.ID `json:"id"`
    31  }
    32  
    33  // GetId returns SimpleInputQueryUser.Id, and is useful for accessing the field via an interface.
    34  func (v *SimpleInputQueryUser) GetId() testutil.ID { return v.Id }
    35  
    36  // __SimpleInputQueryInput is used internally by genqlient
    37  type __SimpleInputQueryInput struct {
    38  	Name string `json:"name"`
    39  }
    40  
    41  // GetName returns __SimpleInputQueryInput.Name, and is useful for accessing the field via an interface.
    42  func (v *__SimpleInputQueryInput) GetName() string { return v.Name }
    43  
    44  func SimpleInputQuery(
    45  	client graphql.Client,
    46  	name string,
    47  ) (*SimpleInputQueryResponse, error) {
    48  	req := &graphql.Request{
    49  		OpName: "SimpleInputQuery",
    50  		Query: `
    51  query SimpleInputQuery ($name: String!) {
    52  	user(query: {name:$name}) {
    53  		id
    54  	}
    55  }
    56  `,
    57  		Variables: &__SimpleInputQueryInput{
    58  			Name: name,
    59  		},
    60  	}
    61  	var err error
    62  
    63  	var data SimpleInputQueryResponse
    64  	resp := &graphql.Response{Data: &data}
    65  
    66  	err = client.MakeRequest(
    67  		nil,
    68  		req,
    69  		resp,
    70  	)
    71  
    72  	return &data, err
    73  }
    74