Versions in this module Expand all Collapse all v0 v0.9.3 Jun 16, 2023 Changes in this version + const ErrGraphQLDecode + const ErrGraphQLEncode + const ErrJsonDecode + const ErrJsonEncode + const ErrRequestError + const GQLConnectionError + const GQLConnectionKeepAlive + const GQLConnectionTerminate + const GQLData + const GQLInternal + const GQLStart + const GQLStop + const GQLUnknown + const GQL_COMPLETE + const GQL_CONNECTION_ACK + const GQL_CONNECTION_ERROR + const GQL_CONNECTION_INIT + const GQL_CONNECTION_KEEP_ALIVE + const GQL_CONNECTION_TERMINATE + const GQL_DATA + const GQL_ERROR + const GQL_INTERNAL + const GQL_START + const GQL_STOP + const GQL_UNKNOWN + const GraphQLWS + const StatusConnectionInitialisationTimeout + const StatusInvalidMessage + const StatusSubscriberAlreadyExists + const StatusTooManyInitialisationRequests + const StatusUnauthorized + const SubscriptionRunning + const SubscriptionUnsubscribed + const SubscriptionWaiting + const SubscriptionsTransportWS + var ErrSubscriptionNotExists = errors.New("subscription does not exist") + var ErrSubscriptionStopped = errors.New("subscription stopped") + func ConstructMutation(v interface{}, variables map[string]interface{}, options ...Option) (string, error) + func ConstructQuery(v interface{}, variables map[string]interface{}, options ...Option) (string, error) + func ConstructSubscription(v interface{}, variables map[string]interface{}, options ...Option) (string, string, error) + func ElemSafe(v reflect.Value) reflect.Value + func FieldSafe(valStruct reflect.Value, i int) reflect.Value + func IndexSafe(v reflect.Value, i int) reflect.Value + func UnmarshalGraphQL(data []byte, v interface{}) error + type Boolean bool + func NewBoolean(v Boolean) *Boolean + type Client struct + func NewClient(url string, httpClient Doer) *Client + func (c *Client) Exec(ctx context.Context, query string, v interface{}, ...) error + func (c *Client) ExecRaw(ctx context.Context, query string, variables map[string]interface{}, ...) ([]byte, error) + func (c *Client) Mutate(ctx context.Context, m interface{}, variables map[string]interface{}, ...) error + func (c *Client) MutateRaw(ctx context.Context, m interface{}, variables map[string]interface{}, ...) ([]byte, error) + func (c *Client) NamedMutate(ctx context.Context, name string, m interface{}, ...) error + func (c *Client) NamedMutateRaw(ctx context.Context, name string, m interface{}, ...) ([]byte, error) + func (c *Client) NamedQuery(ctx context.Context, name string, q interface{}, ...) error + func (c *Client) NamedQueryRaw(ctx context.Context, name string, q interface{}, ...) ([]byte, error) + func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}, ...) error + func (c *Client) QueryRaw(ctx context.Context, q interface{}, variables map[string]interface{}, ...) ([]byte, error) + func (c *Client) WithDebug(debug bool) *Client + func (c *Client) WithRequestModifier(f RequestModifier) *Client + type Doer interface + Do func(*http.Request) (*http.Response, error) + type Error struct + Extensions map[string]interface{} + Locations []struct{ ... } + Message string + Path []interface{} + func (e Error) Error() string + type Errors []Error + func (e Errors) Error() string + type Float float64 + func NewFloat(v Float) *Float + type GraphQLRequestPayload struct + OperationName string + Query string + Variables map[string]interface{} + type GraphQLType interface + GetGraphQLType func() string + type ID string + func NewID(v interface{}) *ID + func ToID(v interface{}) ID + type Int int32 + func NewInt(v Int) *Int + type OperationMessage struct + ID string + Payload json.RawMessage + Type OperationMessageType + func (om OperationMessage) String() string + type OperationMessageType string + const GQLComplete + const GQLConnectionAck + const GQLConnectionInit + const GQLError + const GQLNext + const GQLPing + const GQLPong + const GQLSubscribe + type Option interface + String func() string + Type func() OptionType + func OperationName(name string) Option + type OptionType string + const OptionTypeOperationDirective + type RequestModifier func(*http.Request) + type String string + func NewString(v String) *String + type Subscription struct + func (s *Subscription) SetStatus(status SubscriptionStatus) + func (s Subscription) GetHandler() func(data []byte, err error) + func (s Subscription) GetID() string + func (s Subscription) GetKey() string + func (s Subscription) GetPayload() GraphQLRequestPayload + func (s Subscription) GetStatus() SubscriptionStatus + type SubscriptionClient struct + func NewSubscriptionClient(url string) *SubscriptionClient + func (sc *SubscriptionClient) Close() (err error) + func (sc *SubscriptionClient) Exec(query string, variables map[string]interface{}, ...) (string, error) + func (sc *SubscriptionClient) GetContext() context.Context + func (sc *SubscriptionClient) GetTimeout() time.Duration + func (sc *SubscriptionClient) GetURL() string + func (sc *SubscriptionClient) NamedSubscribe(name string, v interface{}, variables map[string]interface{}, ...) (string, error) + func (sc *SubscriptionClient) OnConnected(fn func()) *SubscriptionClient + func (sc *SubscriptionClient) OnConnectionAlive(fn func()) *SubscriptionClient + func (sc *SubscriptionClient) OnDisconnected(fn func()) *SubscriptionClient + func (sc *SubscriptionClient) OnError(onError func(sc *SubscriptionClient, err error) error) *SubscriptionClient + func (sc *SubscriptionClient) OnSubscriptionComplete(fn func(sub Subscription)) *SubscriptionClient + func (sc *SubscriptionClient) Run() error + func (sc *SubscriptionClient) Subscribe(v interface{}, variables map[string]interface{}, ...) (string, error) + func (sc *SubscriptionClient) SubscribeRaw(query string, variables map[string]interface{}, ...) (string, error) + func (sc *SubscriptionClient) Unsubscribe(id string) error + func (sc *SubscriptionClient) WithConnectionParams(params map[string]interface{}) *SubscriptionClient + func (sc *SubscriptionClient) WithConnectionParamsFn(fn func() map[string]interface{}) *SubscriptionClient + func (sc *SubscriptionClient) WithExitWhenNoSubscription(value bool) *SubscriptionClient + func (sc *SubscriptionClient) WithLog(logger func(args ...interface{})) *SubscriptionClient + func (sc *SubscriptionClient) WithProtocol(protocol SubscriptionProtocolType) *SubscriptionClient + func (sc *SubscriptionClient) WithReadLimit(limit int64) *SubscriptionClient + func (sc *SubscriptionClient) WithRetryStatusCodes(codes ...string) *SubscriptionClient + func (sc *SubscriptionClient) WithRetryTimeout(timeout time.Duration) *SubscriptionClient + func (sc *SubscriptionClient) WithTimeout(timeout time.Duration) *SubscriptionClient + func (sc *SubscriptionClient) WithWebSocket(fn func(sc *SubscriptionClient) (WebsocketConn, error)) *SubscriptionClient + func (sc *SubscriptionClient) WithWebSocketOptions(options WebsocketOptions) *SubscriptionClient + func (sc *SubscriptionClient) WithoutLogTypes(types ...OperationMessageType) *SubscriptionClient + type SubscriptionContext struct + OnConnected func() + OnConnectionAlive func() + OnDisconnected func() + OnSubscriptionComplete func(sub Subscription) + func (sc *SubscriptionContext) Cancel() + func (sc *SubscriptionContext) Close() error + func (sc *SubscriptionContext) GetAcknowledge() bool + func (sc *SubscriptionContext) GetContext() context.Context + func (sc *SubscriptionContext) GetSubscription(id string) *Subscription + func (sc *SubscriptionContext) GetSubscriptions() map[string]Subscription + func (sc *SubscriptionContext) GetSubscriptionsLength(status []SubscriptionStatus) int + func (sc *SubscriptionContext) GetWebsocketConn() WebsocketConn + func (sc *SubscriptionContext) Log(message interface{}, source string, opType OperationMessageType) + func (sc *SubscriptionContext) NewContext() + func (sc *SubscriptionContext) Send(message interface{}, opType OperationMessageType) error + func (sc *SubscriptionContext) SetAcknowledge(value bool) + func (sc *SubscriptionContext) SetSubscription(key string, sub *Subscription) + func (sc *SubscriptionContext) SetWebsocketConn(conn WebsocketConn) + type SubscriptionProtocol interface + Close func(ctx *SubscriptionContext) error + ConnectionInit func(ctx *SubscriptionContext, connectionParams map[string]interface{}) error + GetSubprotocols func() []string + OnMessage func(ctx *SubscriptionContext, subscription Subscription, message OperationMessage) error + Subscribe func(ctx *SubscriptionContext, sub Subscription) error + Unsubscribe func(ctx *SubscriptionContext, sub Subscription) error + type SubscriptionProtocolType string + type SubscriptionStatus int32 + type WebsocketConn interface + Close func() error + GetCloseStatus func(error) int32 + ReadJSON func(v interface{}) error + SetReadLimit func(limit int64) + WriteJSON func(v interface{}) error + type WebsocketHandler struct + func (wh *WebsocketHandler) Close() error + func (wh *WebsocketHandler) GetCloseStatus(err error) int32 + func (wh *WebsocketHandler) ReadJSON(v interface{}) error + func (wh *WebsocketHandler) WriteJSON(v interface{}) error + type WebsocketOptions struct + HTTPClient *http.Client