这是indexloc提供的服务,不要输入任何密码
Skip to content

Releases: hasura/go-graphql-client

v0.11.0

03 Feb 05:40
8f1d49e
Compare
Choose a tag to compare

What's Changed

  • feat: add Path []interface{} field to GraphQL Error object by @dpulpeiro in #121
  • feat: include error detail when retrying WebSocket timeout by @kacperdrobny in #123
  • feat: add more WebSocket options for subscription client by @hgiasac in #126

New Contributors

Full Changelog: v0.10.2...v0.11.0

v0.10.2

06 Jan 17:04
48aa45c
Compare
Choose a tag to compare

Changelog

  • feat: update latest dependencies (#118) @hgiasac
  • fix: skip ErrClosed errors when closing the WebSocket connection and retry when the connection is closed unexpectedly (#119) @hgiasac

v0.10.1

03 Dec 02:19
dacf52d
Compare
Choose a tag to compare

Changelog

v0.10.0

13 Aug 08:33
1956215
Compare
Choose a tag to compare

Breaking changes

This release upgrades Go version to 1.20 with the latest dependencies. Don't upgrade this version if you don't plan to upgrade Go v1.20.

Changelog

v0.9.3

27 Apr 16:35
1741410
Compare
Choose a tag to compare

Changelog

  • ident: add GitLab, DevOps, IssueHunt, LFX brands (fa10f16)
  • internal/jsonutil: support directives directly after name (a465542)
  • fix: OnError message is not called in subscriptions-transport-ws (1741410) @tangxusc

v0.9.2

17 Mar 15:20
0acd9d9
Compare
Choose a tag to compare

This release adds new callback events for the subscription client that are useful for debugging and testing.

// OnConnectionAlive event is triggered whenever the WebSocket connection 
// receives a connection alive message (differs per protocol)
client.OnConnectionAlive(fn func())

// OnSubscriptionComplete event is triggered when the subscription receives 
// a terminated message from the server
client.OnSubscriptionComplete(fn func(sub Subscription))

New settings are also added to control the retry and exit behaviors of the subscription client.

client.WithoutLogTypes(graphql.GQLData, graphql.GQLConnectionKeepAlive).
    // the client should exit when all subscriptions were closed, default true
    WithExitWhenNoSubscription(false).
    // WithRetryStatusCodes allow retrying the subscription connection when receiving one of these codes
    // the input parameter can be a number string or range, e.g 4000-5000 
   WithRetryStatusCodes("4000", "4000-4050")

Changelog

  • add OnConnectionAlive event to the subscription client (#77) @sermojohn
  • fix: prevent panic on late message after unsubscribed subscription (#79) @sermojohn
  • improve the subscription life cycle events and add new settings (#82) @hgiasac

v0.9.1

28 Feb 17:09
bb54675
Compare
Choose a tag to compare

Changelog

  • improve the subscription client, fix goroutine leaks and data race issues (#76) @hgiasac
  • merge the reset subscription logic into the Run method. If you call the Run method when the subscription client is running, the client will restart the current connection.
  • print the extra Extensions information in the Error object

v0.9.0

13 Feb 07:54
10471cf
Compare
Choose a tag to compare

Highlight

Support graphql-ws protocol

The subscription client now supports 2 protocols:

The protocol can be switchable by the WithProtocol function. By default, the subscription client uses the subscriptions-transport-ws protocol.

client := graphql.NewSubscriptionClient("wss://example.com/graphql").
    WithProtocol(graphql.GraphQLWS)

Changelog

  • exposed the UnmarshalGraphQL function in the jsonutil package (#62) @nico151999
  • fix the dynamic GraphQL type output from the GraphQLType interface instance (#56) @hgiasac
  • support graphql-ws protocol (#67) @hgiasac
  • allow using custom HTTP client that implements Doer interface (#68) @senekis
  • patch gin v1.7.7 to fix the security issue (#75) @hgiasac

v0.8.1

29 Sep 07:58
835e565
Compare
Choose a tag to compare

v0.8.0

09 Aug 05:44
93707b1
Compare
Choose a tag to compare

Highlight

Introduce ExecRaw method that returns a raw json message.

query := `query{something(where: { foo: { _eq: "bar" }}){id}}`
var res struct {
	Somethings []Something `json:"something"`
}

raw, err := client.ExecRaw(ctx, query, map[string]any{}) 
if err != nil {
	panic(err)
}

err = json.Unmarshal(raw, &res)

Breaking change: currently QueryRaw, MutateRaw and Subscribe methods return *json.RawMessage. This output type is redundant to be decoded. The output type should be changed to []byte.

var subscription struct {
	Me struct {
		Name graphql.String
	}
}

subscriptionId, err := client.Subscribe(&query, nil, func(dataValue []byte, errValue error) error {
	if errValue != nil {
		// handle error
		// if returns error, it will failback to `onError` event
		return nil
	}
	data := query{}
	err := json.Unmarshal(dataValue, &data)

	fmt.Println(query.Me.Name)

	// Output: Luke Skywalker
	return nil
})

if err != nil {
	// Handle error.
}

Changelog

  • Propagate errors instead of panic when building the GraphQL string by reflection (#41) @grihabor
  • add ExecRaw and change the output type of Raw methods. Remove canonical/vanity import path (#44) @hgiasac