github.com/codykaup/genqlient@v0.6.2/generate/testdata/snapshots/TestGenerateWithConfig-PackageBindings-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  // SimpleQueryResponse is returned by SimpleQuery on success.
    13  type SimpleQueryResponse struct {
    14  	// user looks up a user by some stuff.
    15  	//
    16  	// See UserQueryInput for what stuff is supported.
    17  	// If query is null, returns the current user.
    18  	User SimpleQueryUser `json:"user"`
    19  }
    20  
    21  // GetUser returns SimpleQueryResponse.User, and is useful for accessing the field via an interface.
    22  func (v *SimpleQueryResponse) GetUser() SimpleQueryUser { return v.User }
    23  
    24  // SimpleQueryUser includes the requested fields of the GraphQL type User.
    25  // The GraphQL type's documentation follows.
    26  //
    27  // A User is a user!
    28  type SimpleQueryUser struct {
    29  	// id is the user's ID.
    30  	//
    31  	// It is stable, unique, and opaque, like all good IDs.
    32  	Id testutil.ID `json:"id"`
    33  }
    34  
    35  // GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
    36  func (v *SimpleQueryUser) GetId() testutil.ID { return v.Id }
    37  
    38  // The query or mutation executed by SimpleQuery.
    39  const SimpleQuery_Operation = `
    40  query SimpleQuery {
    41  	user {
    42  		id
    43  	}
    44  }
    45  `
    46  
    47  func SimpleQuery(
    48  	ctx_ context.Context,
    49  	client_ graphql.Client,
    50  ) (*SimpleQueryResponse, error) {
    51  	req_ := &graphql.Request{
    52  		OpName: "SimpleQuery",
    53  		Query:  SimpleQuery_Operation,
    54  	}
    55  	var err_ error
    56  
    57  	var data_ SimpleQueryResponse
    58  	resp_ := &graphql.Response{Data: &data_}
    59  
    60  	err_ = client_.MakeRequest(
    61  		ctx_,
    62  		req_,
    63  		resp_,
    64  	)
    65  
    66  	return &data_, err_
    67  }
    68