Skip to content

Conversation

hgiasac
Copy link

@hgiasac hgiasac commented Jun 29, 2024

The response map may also contain an entry with key extensions. To decode this field you need to bind a struct or map pointer. The client will optionally unmarshal the field using json decoder.

var q struct {
	User struct {
		ID   string `graphql:"id"`
		Name string `graphql:"name"`
	}
}

var ext struct {
	ID     int    `json:"id"`
	Domain string `json:"domain"`
}

err := client.Query(context.Background(), &q, map[string]interface{}{}, graphql.BindExtensions(&ext))
if err != nil {
	t.Fatal(err)
}

Copy link

github-actions bot commented Jun 29, 2024

Code Coverage

Package Line Rate Health
github.com/hasura/go-graphql-client 67%
github.com/hasura/go-graphql-client/ident 100%
github.com/hasura/go-graphql-client/pkg/jsonutil 84%
Summary 72% (1412 / 1959)

Minimum allowed line rate is 60%

@hgiasac hgiasac merged commit 1d68c4a into master Jun 29, 2024
@hgiasac hgiasac deleted the add-query-mutation-with-extensions branch June 29, 2024 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant