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

github.com/maximeheckel/graphql-query-builder

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/maximeheckel/graphql-query-builder

  • v0.0.0-20161211234053-50a6708c22d1
  • Source
  • Go
  • Socket score

Version published
Created
Source

graphql-query-builder

A simple graphQL query builder built in Golang

Getting started

To install the library run:

go get github.com/MaximeHeckel/graphql-query-builder/querybuilder

Example

Here's a simple example which shows how to build a simple query using the library.

package main

import (
	"log"

	"github.com/MaximeHeckel/graphql-query-builder/querybuilder"
)

func main() {

	filter := querybuilder.NewQueryFilter(map[string]interface{}{"testfilter": "1234"})

	// NewQuery constructs the query
	// Filter is an optional argument to the constructor to set a parameter to 
	// run the query against
	query, _ := querybuilder.NewQuery("test", filter)
	query2, _ := querybuilder.NewQuery("nestedQuery")

	// Set an alias for the result of this query
	query2.SetAlias("myNestedQuery")

	// User find to set the properties to be returned from the query
	query2.Find([]interface{}{"nestedValue"})
	query.Find([]interface{}{"value", map[string]string{"hello": "test"}, map[string]int{"world": 2}, map[string]*querybuilder.Query{"testquery": query2}})

	// ToString() returns the string representation of the method
	log.Println(query.ToString())
}

Tests

To run the tests:

go test -v

FAQs

Package last updated on 11 Dec 2016

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