Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the example to show json decoding #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update README to show field renaming
  • Loading branch information
simobiggs authored Mar 5, 2020
commit 3c1579701ce269c69f297da04eb508ca2f7d69e9
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ $ go get github.com/machinebox/graphql
```go
import "context"

type ResponseStruct struct {
field1 string
field2 string
field2 string
ID string `json:"_id"` // GQL fields may be renamed as per normal json
}

// create a client (safe to share across requests)
client := graphql.NewClient("https://machinebox.io/graphql")

Expand All @@ -31,6 +38,7 @@ req := graphql.NewRequest(`
field1
field2
field3
_id
}
}
`)
Expand Down