• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

benchutil/H03-Jun-2018-256226

examples/H03-Jun-2018-738570

gqlerrors/H03-Jun-2018-262224

language/H03-Jun-2018-10,3009,010

testutil/H03-Jun-2018-1,4961,430

.gitignoreH A D03-Jun-201815 22

.travis.ymlH A D03-Jun-2018293 2116

CONTRIBUTING.mdH A D03-Jun-20185.9 KiB140102

LICENSEH A D03-Jun-20181.1 KiB2217

README.mdH A D03-Jun-20183.2 KiB7660

abstract_test.goH A D03-Jun-201813.8 KiB649604

definition.goH A D03-Jun-201831.8 KiB1,279943

definition_test.goH A D03-Jun-201817.5 KiB644603

directives.goH A D03-Jun-20184.6 KiB149118

directives_test.goH A D03-Jun-201815.3 KiB589558

enum_type_test.goH A D03-Jun-201811.8 KiB424411

executor.goH A D03-Jun-201826.1 KiB922756

executor_resolve_test.goH A D03-Jun-20187 KiB267236

executor_schema_test.goH A D03-Jun-20186.9 KiB316289

executor_test.goH A D03-Jun-201840.6 KiB1,8101,589

graphql.goH A D03-Jun-20181.6 KiB6441

graphql_bench_test.goH A D03-Jun-20182.3 KiB12598

graphql_test.goH A D03-Jun-20185.8 KiB249227

introspection.goH A D03-Jun-201821.8 KiB764686

introspection_test.goH A D03-Jun-201837.3 KiB1,4721,450

kitchen-sink.graphqlH A D03-Jun-2018823 5347

lists_test.goH A D03-Jun-201818.2 KiB783685

located.goH A D03-Jun-2018706 3834

mutations_test.goH A D03-Jun-20186.5 KiB253233

nonnull_test.goH A D03-Jun-201826.6 KiB1,1351,058

quoted_or_list_internal_test.goH A D03-Jun-2018991 3633

rules.goH A D03-Jun-201855.5 KiB1,8931,617

rules_arguments_of_correct_type_test.goH A D03-Jun-201823.3 KiB802785

rules_default_values_of_correct_type_test.goH A D03-Jun-20183.6 KiB108103

rules_fields_on_correct_type_test.goH A D03-Jun-20188.8 KiB243233

rules_fragments_on_composite_types_test.goH A D03-Jun-20182.8 KiB8884

rules_known_argument_names_test.goH A D03-Jun-20184.4 KiB136132

rules_known_directives_rule_test.goH A D03-Jun-20185.2 KiB166145

rules_known_fragment_names_test.goH A D03-Jun-20181.3 KiB5652

rules_known_type_names_test.goH A D03-Jun-20181.6 KiB6257

rules_lone_anonymous_operation_rule_test.goH A D03-Jun-20182.2 KiB8478

rules_no_fragment_cycles_test.goH A D03-Jun-20186.2 KiB179171

rules_no_undefined_variables_test.goH A D03-Jun-20188 KiB266262

rules_no_unused_fragments_test.goH A D03-Jun-20183.1 KiB139135

rules_no_unused_variables_test.goH A D03-Jun-20185.2 KiB190186

rules_overlapping_fields_can_be_merged.goH A D03-Jun-201824.7 KiB707473

rules_overlapping_fields_can_be_merged_test.goH A D03-Jun-201826.1 KiB895871

rules_possible_fragment_spreads_test.goH A D03-Jun-20188.2 KiB183174

rules_provided_non_null_arguments_test.goH A D03-Jun-20185.6 KiB178171

rules_scalar_leafs_test.goH A D03-Jun-20183.1 KiB8984

rules_unique_argument_names_test.goH A D03-Jun-20183.5 KiB113109

rules_unique_fragment_names_test.goH A D03-Jun-20182.2 KiB9691

rules_unique_input_field_names_test.goH A D03-Jun-20181.9 KiB6662

rules_unique_operation_names_test.goH A D03-Jun-20182.8 KiB111102

rules_unique_variable_names_test.goH A D03-Jun-20181 KiB2925

rules_variables_are_input_types_test.goH A D03-Jun-2018906 2925

rules_variables_in_allowed_position_test.goH A D03-Jun-20188 KiB247239

scalars.goH A D03-Jun-20187.3 KiB330300

scalars_parsevalue_test.goH A D03-Jun-2018645 2723

scalars_serialization_test.goH A D03-Jun-20184.9 KiB200175

schema-kitchen-sink.graphqlH A D03-Jun-20181.3 KiB7152

schema.goH A D03-Jun-201814.2 KiB539426

suggested_list_internal_test.goH A D03-Jun-2018821 2926

type_comparators_internal_test.goH A D03-Jun-20184 KiB150139

type_info.goH A D03-Jun-20187.7 KiB277241

types.goH A D03-Jun-2018294 1711

union_interface_test.goH A D03-Jun-201812.9 KiB588538

util.goH A D03-Jun-20183.7 KiB193161

util_test.goH A D03-Jun-20183.9 KiB179155

validation_test.goH A D03-Jun-201848.2 KiB1,6471,581

validator.goH A D03-Jun-20188.6 KiB288236

validator_test.goH A D03-Jun-20182.5 KiB9984

values.goH A D03-Jun-201812 KiB463384

variables_test.goH A D03-Jun-201837.9 KiB1,5051,370

README.md

1# graphql [![Build Status](https://travis-ci.org/graphql-go/graphql.svg)](https://travis-ci.org/graphql-go/graphql) [![GoDoc](https://godoc.org/graphql.co/graphql?status.svg)](https://godoc.org/github.com/graphql-go/graphql) [![Coverage Status](https://coveralls.io/repos/graphql-go/graphql/badge.svg?branch=master&service=github)](https://coveralls.io/github/graphql-go/graphql?branch=master) [![Join the chat at https://gitter.im/graphql-go/graphql](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/graphql-go/graphql?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
3An implementation of GraphQL in Go. Follows the official reference implementation [`graphql-js`](https://github.com/graphql/graphql-js).
4
5Supports: queries, mutations & subscriptions.
6
7### Documentation
8
9godoc: https://godoc.org/github.com/graphql-go/graphql
10
11### Getting Started
12
13To install the library, run:
14```bash
15go get github.com/graphql-go/graphql
16```
17
18The following is a simple example which defines a schema with a single `hello` string-type field and a `Resolve` method which returns the string `world`. A GraphQL query is performed against this schema with the resulting output printed in JSON format.
19
20```go
21package main
22
23import (
24	"encoding/json"
25	"fmt"
26	"log"
27
28	"github.com/graphql-go/graphql"
29)
30
31func main() {
32	// Schema
33	fields := graphql.Fields{
34		"hello": &graphql.Field{
35			Type: graphql.String,
36			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
37				return "world", nil
38			},
39		},
40	}
41	rootQuery := graphql.ObjectConfig{Name: "RootQuery", Fields: fields}
42	schemaConfig := graphql.SchemaConfig{Query: graphql.NewObject(rootQuery)}
43	schema, err := graphql.NewSchema(schemaConfig)
44	if err != nil {
45		log.Fatalf("failed to create new schema, error: %v", err)
46	}
47
48	// Query
49	query := `
50		{
51			hello
52		}
53	`
54	params := graphql.Params{Schema: schema, RequestString: query}
55	r := graphql.Do(params)
56	if len(r.Errors) > 0 {
57		log.Fatalf("failed to execute graphql operation, errors: %+v", r.Errors)
58	}
59	rJSON, _ := json.Marshal(r)
60	fmt.Printf("%s \n", rJSON) // {“data”:{“hello”:”world”}}
61}
62```
63For more complex examples, refer to the [examples/](https://github.com/graphql-go/graphql/tree/master/examples/) directory and [graphql_test.go](https://github.com/graphql-go/graphql/blob/master/graphql_test.go).
64
65### Third Party Libraries
66| Name          | Author        | Description  |
67|:-------------:|:-------------:|:------------:|
68| [graphql-go-handler](https://github.com/graphql-go/graphql-go-handler) | [Hafiz Ismail](https://github.com/sogko) | Middleware to handle GraphQL queries through HTTP requests. |
69| [graphql-relay-go](https://github.com/graphql-go/graphql-relay-go) | [Hafiz Ismail](https://github.com/sogko) | Lib to construct a graphql-go server supporting react-relay. |
70| [golang-relay-starter-kit](https://github.com/sogko/golang-relay-starter-kit) | [Hafiz Ismail](https://github.com/sogko) | Barebones starting point for a Relay application with Golang GraphQL server. |
71| [dataloader](https://github.com/nicksrandall/dataloader) | [Nick Randall](https://github.com/nicksrandall) | [DataLoader](https://github.com/facebook/dataloader) implementation in Go. |
72
73### Blog Posts
74- [Golang + GraphQL + Relay](http://wehavefaces.net/)
75
76