Skip to content

Commit

Permalink
refactor: expose jsonutil (shurcooL#62)
Browse files Browse the repository at this point in the history
Exposed the jsonutil package with unmarshal json method
  • Loading branch information
nico151999 authored Dec 8, 2022
1 parent 1992b9f commit 4e08b2d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,8 @@ subscriptionId, err := client.Subscribe(&query, nil, func(dataValue []byte, errV
return nil
}
data := query{}
err := json.Unmarshal(dataValue, &data)
// use the github.com/hasura/go-graphql-client/pkg/jsonutil package
err := jsonutil.UnmarshalGraphQL(dataValue, &data)

fmt.Println(query.Me.Name)

Expand Down
2 changes: 1 addition & 1 deletion graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"net/http"
"strings"

"github.com/hasura/go-graphql-client/internal/jsonutil"
"github.com/hasura/go-graphql-client/pkg/jsonutil"
)

// This function allows you to tweak the HTTP request. It might be useful to set authentication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

"github.com/hasura/go-graphql-client/internal/jsonutil"
"github.com/hasura/go-graphql-client/pkg/jsonutil"
)

func TestUnmarshalGraphQL_benchmark(t *testing.T) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/hasura/go-graphql-client/internal/jsonutil"
"github.com/hasura/go-graphql-client/pkg/jsonutil"
)

func TestUnmarshalGraphQL(t *testing.T) {
Expand Down

0 comments on commit 4e08b2d

Please sign in to comment.