Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/Laisky/graphql

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/Laisky/graphql

  • v1.0.6
  • Source
  • Go
  • Socket score

Version published
Created
Source

Golang GraphQL Client

GitHub release License: MIT Commitizen friendly Go Report Card GoDoc Build Status codecov

Fully compatible with https://github.com/shurcooL/graphql

You can simply replace github.com/shurcooL/graphql --> github.com/Laisky/graphql to access new features.

New Features

Cache friendly

use HTTP GET when request graphql query, use HTTP POST when request graphql mutation.

Set Headers & Cookies

cli := NewClient(
    "url",
    httpClient,
    graphql.WithCookie("cookieName", "cookieVal"),
    graphql.WithHeader("headerName", "headerVal"),
)

Usage

package test

import (
	"context"
	"net/http"
	"testing"

	"github.com/Laisky/graphql"
)

type gcpLockQuery struct {
	Lock struct {
		Name      graphql.String `graphql:"name"`
		ExpiresAt graphql.String `graphql:"expires_at"`
	} `graphql:"Lock(name: $name)"`
}

func TestQueryWithHTTPGet(t *testing.T) {
	ctx := context.Background()
	httpClient := http.DefaultClient
	query := new(gcpLockQuery)
	vars := map[string]interface{}{
		"name": graphql.String("laisky.123"),
	}
	gracli := graphql.NewClient(
		"https://blog.laisky.com/graphql/query/",
		httpClient,
	)
	if err := gracli.Query(ctx, query, vars); err != nil {
		t.Fatalf("%+v", err)
	}

}

FAQs

Package last updated on 10 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc