go-graphql-cli

command module
v0.0.0-...-f076a92 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-graphql-cli

Command -line graphql client written in golang. Based on https://github.com/machinebox/graphql.

Installation

go install github.com/miko/go-graphql-cli@latest

Usage

Usage of go-graphql-cli:
  -debug
    	Debugging
  -header value
    	HTTP Header (key: value)
  -query string
    	Graphql query (or GRAPHQL_QUERY from env) (default "query ($code:String!=\"US\"){countries(filter:{code:{eq:$code}}){ capital name continent {name}}}")
  -url string
    	Graphql server URL (or GRAPHQL_URL from env) (default "https://countries.trevorblades.com/")
  -var value
    	GraphQL variable (key=value)

Example:

$ export GRAPHQL_URL=https://countries.trevorblades.com/
$ export GRAPHQL_QUERY='query ($code:String!="US"){countries(filter:{code:{eq:$code}}){ capital name continent {name}}}'
$ go-graphql-cli -var code=PL
{
  "countries": [
    {
      "capital": "Warsaw",
      "continent": {
        "name": "Europe"
      },
      "name": "Poland"
    }
  ]
}

$ go-graphql-cli -var user=john -var password=pass -query 'query Login($login:String!, $password:String!) {login(login:$login,password:$password) {first_name last_name}}'
{
  "login": 
    {
      "first_name": "John",
      "last_name": "Doe"
    }
  
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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