gql

package
v0.0.0-...-af6c1de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrResponseWithErrors = errors.New("Client response return with errors")
View Source
var ErrTargetIsNotPointer = errors.New("Client request target is not pointer")

Functions

func Sanitize

func Sanitize(query string) string

Types

type Boolean

type Boolean bool

type Client

type Client struct {
	URL string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url string, httpClient *http.Client) *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *Request, target any) (*Response, error)

type Float

type Float float64

type ID

type ID string

func NewID

func NewID(v any) *ID

func ToID

func ToID(v any) ID

type Int

type Int int32

type Request

type Request struct {
	Query     string         `json:"query"`
	Variables map[string]any `json:"variables,omitempty"`
}

func NewRequest

func NewRequest(query string, variables map[string]any) *Request

func (*Request) Buffer

func (r *Request) Buffer() (*bytes.Buffer, error)

type Response

type Response struct {
	Data       any                        `json:"data"`
	Errors     []gqlerrors.FormattedError `json:"errors,omitempty"`
	Extensions map[string]any             `json:"extensions,omitempty"`
}

func (*Response) Err

func (r *Response) Err() error

func (*Response) HasErrors

func (r *Response) HasErrors() bool

func (*Response) To

func (r *Response) To(v any) error

type String

type String string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL