github.com/Desuuuu/genqlient@v0.5.3/generate/testdata/snapshots/TestGenerate-SimpleMutation.graphql-SimpleMutation.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  // SimpleMutationCreateUser includes the requested fields of the GraphQL type User.
    11  // The GraphQL type's documentation follows.
    12  //
    13  // A User is a user!
    14  type SimpleMutationCreateUser struct {
    15  	// id is the user's ID.
    16  	//
    17  	// It is stable, unique, and opaque, like all good IDs.
    18  	Id   testutil.ID `json:"id"`
    19  	Name string      `json:"name"`
    20  }
    21  
    22  // GetId returns SimpleMutationCreateUser.Id, and is useful for accessing the field via an interface.
    23  func (v *SimpleMutationCreateUser) GetId() testutil.ID { return v.Id }
    24  
    25  // GetName returns SimpleMutationCreateUser.Name, and is useful for accessing the field via an interface.
    26  func (v *SimpleMutationCreateUser) GetName() string { return v.Name }
    27  
    28  // SimpleMutationResponse is returned by SimpleMutation on success.
    29  type SimpleMutationResponse struct {
    30  	CreateUser SimpleMutationCreateUser `json:"createUser"`
    31  }
    32  
    33  // GetCreateUser returns SimpleMutationResponse.CreateUser, and is useful for accessing the field via an interface.
    34  func (v *SimpleMutationResponse) GetCreateUser() SimpleMutationCreateUser { return v.CreateUser }
    35  
    36  // __SimpleMutationInput is used internally by genqlient
    37  type __SimpleMutationInput struct {
    38  	Name string `json:"name"`
    39  }
    40  
    41  // GetName returns __SimpleMutationInput.Name, and is useful for accessing the field via an interface.
    42  func (v *__SimpleMutationInput) GetName() string { return v.Name }
    43  
    44  // SimpleMutation creates a user.
    45  //
    46  // It has a long doc-comment, to test that we handle that correctly.
    47  // What a long comment indeed.
    48  func SimpleMutation(
    49  	client graphql.Client,
    50  	name string,
    51  ) (*SimpleMutationResponse, error) {
    52  	req := &graphql.Request{
    53  		OpName: "SimpleMutation",
    54  		Query: `
    55  mutation SimpleMutation ($name: String!) {
    56  	createUser(name: $name) {
    57  		id
    58  		name
    59  	}
    60  }
    61  `,
    62  		Variables: &__SimpleMutationInput{
    63  			Name: name,
    64  		},
    65  	}
    66  	var err error
    67  
    68  	var data SimpleMutationResponse
    69  	resp := &graphql.Response{Data: &data}
    70  
    71  	err = client.MakeRequest(
    72  		nil,
    73  		req,
    74  		resp,
    75  	)
    76  
    77  	return &data, err
    78  }
    79