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