Documentation
¶
Overview ¶
Package gqlclient provides a GraphQL client.
Index ¶
- func MakeListenAddress(uri string) (hostport string, e error)
- type Client
- func (c *Client) Close() error
- func (c *Client) Delete(ctx context.Context, id string) (deleted bool, e error)
- func (c *Client) Do(ctx context.Context, query string, vars map[string]any, key string, res any) error
- func (c *Client) Subscribe(ctx context.Context, query string, vars map[string]any, key string, res any) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeListenAddress ¶
MakeListenAddress constructs server listen string.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a GraphQL client.
func (*Client) Do ¶
func (c *Client) Do(ctx context.Context, query string, vars map[string]any, key string, res any) error
Do runs a query or mutation on the GraphQL server.
ctx: a Context for canceling the operation. query: a GraphQL document. vars: query variables. key: if non-empty, unmarshal result.data[key] instead of result.data. res: pointer to result struct.
func (*Client) Subscribe ¶
func (c *Client) Subscribe(ctx context.Context, query string, vars map[string]any, key string, res any) error
Subscribe performs a subscription on the GraphQL server.
ctx: a Context for canceling the subscription. query: a GraphQL document. vars: query variables. key: if non-empty, unmarshal result.data[key] instead of result.data. res: channel for sending updates.
type Config ¶
type Config struct { // HTTPUri is HTTP URI for query and mutation operations. HTTPUri string HTTPClient *http.Client // WebSocketUri is WebSocket URI for subscription operations. // Default is same as HTTPURI except changing the scheme. WebSocketUri string WebSocketDialer *gqlws.Dialer }
Config contains Client configuration.
Click to show internal directories.
Click to hide internal directories.