|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| .circleci/ | H | 05-Feb-2020 | - | 54 | 49 |
| benchutil/ | H | 05-Feb-2020 | - | 256 | 226 |
| examples/ | H | 05-Feb-2020 | - | 1,620 | 1,246 |
| gqlerrors/ | H | 05-Feb-2020 | - | 290 | 248 |
| language/ | H | 05-Feb-2020 | - | 10,211 | 8,935 |
| testutil/ | H | 05-Feb-2020 | - | 1,533 | 1,465 |
| .gitignore | H A D | 05-Feb-2020 | 15 | 2 | 2 |
| CONTRIBUTING.md | H A D | 05-Feb-2020 | 5.9 KiB | 139 | 101 |
| LICENSE | H A D | 05-Feb-2020 | 1.1 KiB | 22 | 17 |
| README.md | H A D | 05-Feb-2020 | 3.3 KiB | 76 | 60 |
| abstract_test.go | H A D | 05-Feb-2020 | 13.8 KiB | 657 | 616 |
| definition.go | H A D | 05-Feb-2020 | 32.6 KiB | 1,320 | 976 |
| definition_test.go | H A D | 05-Feb-2020 | 18.2 KiB | 669 | 626 |
| directives.go | H A D | 05-Feb-2020 | 4.6 KiB | 149 | 118 |
| directives_test.go | H A D | 05-Feb-2020 | 13.4 KiB | 517 | 486 |
| enum_type_test.go | H A D | 05-Feb-2020 | 12.8 KiB | 463 | 449 |
| executor.go | H A D | 05-Feb-2020 | 31.8 KiB | 1,080 | 874 |
| executor_resolve_test.go | H A D | 05-Feb-2020 | 7 KiB | 267 | 236 |
| executor_schema_test.go | H A D | 05-Feb-2020 | 6.9 KiB | 316 | 289 |
| executor_test.go | H A D | 05-Feb-2020 | 54.2 KiB | 2,417 | 2,134 |
| extensions.go | H A D | 05-Feb-2020 | 8 KiB | 252 | 195 |
| extensions_test.go | H A D | 05-Feb-2020 | 11.9 KiB | 472 | 401 |
| go.mod | H A D | 05-Feb-2020 | 37 | 2 | 1 |
| graphql.go | H A D | 05-Feb-2020 | 2.8 KiB | 117 | 75 |
| graphql_bench_test.go | H A D | 05-Feb-2020 | 2.4 KiB | 125 | 98 |
| graphql_test.go | H A D | 05-Feb-2020 | 6.3 KiB | 271 | 249 |
| introspection.go | H A D | 05-Feb-2020 | 22.4 KiB | 784 | 705 |
| introspection_test.go | H A D | 05-Feb-2020 | 37.3 KiB | 1,471 | 1,449 |
| kitchen-sink.graphql | H A D | 05-Feb-2020 | 823 | 53 | 47 |
| lists_test.go | H A D | 05-Feb-2020 | 21.5 KiB | 926 | 804 |
| located.go | H A D | 05-Feb-2020 | 1.1 KiB | 52 | 44 |
| mutations_test.go | H A D | 05-Feb-2020 | 6.5 KiB | 253 | 233 |
| nonnull_test.go | H A D | 05-Feb-2020 | 26.4 KiB | 1,174 | 1,097 |
| quoted_or_list_internal_test.go | H A D | 05-Feb-2020 | 991 | 36 | 33 |
| race_test.go | H A D | 05-Feb-2020 | 1.2 KiB | 65 | 56 |
| rules.go | H A D | 05-Feb-2020 | 55.5 KiB | 1,893 | 1,617 |
| rules_arguments_of_correct_type_test.go | H A D | 05-Feb-2020 | 23.3 KiB | 802 | 785 |
| rules_default_values_of_correct_type_test.go | H A D | 05-Feb-2020 | 3.6 KiB | 108 | 103 |
| rules_fields_on_correct_type_test.go | H A D | 05-Feb-2020 | 8.8 KiB | 243 | 233 |
| rules_fragments_on_composite_types_test.go | H A D | 05-Feb-2020 | 2.8 KiB | 88 | 84 |
| rules_known_argument_names_test.go | H A D | 05-Feb-2020 | 4.4 KiB | 136 | 132 |
| rules_known_directives_rule_test.go | H A D | 05-Feb-2020 | 5.2 KiB | 166 | 145 |
| rules_known_fragment_names_test.go | H A D | 05-Feb-2020 | 1.3 KiB | 56 | 52 |
| rules_known_type_names_test.go | H A D | 05-Feb-2020 | 1.6 KiB | 62 | 57 |
| rules_lone_anonymous_operation_rule_test.go | H A D | 05-Feb-2020 | 2.2 KiB | 84 | 78 |
| rules_no_fragment_cycles_test.go | H A D | 05-Feb-2020 | 6.2 KiB | 179 | 171 |
| rules_no_undefined_variables_test.go | H A D | 05-Feb-2020 | 8 KiB | 266 | 262 |
| rules_no_unused_fragments_test.go | H A D | 05-Feb-2020 | 3.1 KiB | 139 | 135 |
| rules_no_unused_variables_test.go | H A D | 05-Feb-2020 | 5.2 KiB | 190 | 186 |
| rules_overlapping_fields_can_be_merged.go | H A D | 05-Feb-2020 | 24.8 KiB | 707 | 473 |
| rules_overlapping_fields_can_be_merged_test.go | H A D | 05-Feb-2020 | 26.4 KiB | 903 | 879 |
| rules_possible_fragment_spreads_test.go | H A D | 05-Feb-2020 | 8.2 KiB | 183 | 174 |
| rules_provided_non_null_arguments_test.go | H A D | 05-Feb-2020 | 5.6 KiB | 178 | 171 |
| rules_scalar_leafs_test.go | H A D | 05-Feb-2020 | 3.1 KiB | 89 | 84 |
| rules_unique_argument_names_test.go | H A D | 05-Feb-2020 | 3.6 KiB | 113 | 109 |
| rules_unique_fragment_names_test.go | H A D | 05-Feb-2020 | 2.2 KiB | 96 | 91 |
| rules_unique_input_field_names_test.go | H A D | 05-Feb-2020 | 1.9 KiB | 66 | 62 |
| rules_unique_operation_names_test.go | H A D | 05-Feb-2020 | 2.8 KiB | 111 | 102 |
| rules_unique_variable_names_test.go | H A D | 05-Feb-2020 | 1 KiB | 29 | 25 |
| rules_variables_are_input_types_test.go | H A D | 05-Feb-2020 | 918 | 29 | 25 |
| rules_variables_in_allowed_position_test.go | H A D | 05-Feb-2020 | 8 KiB | 247 | 239 |
| scalars.go | H A D | 05-Feb-2020 | 10.8 KiB | 571 | 538 |
| scalars_parse_test.go | H A D | 05-Feb-2020 | 1.4 KiB | 55 | 50 |
| scalars_serialization_test.go | H A D | 05-Feb-2020 | 4.9 KiB | 200 | 175 |
| scalars_test.go | H A D | 05-Feb-2020 | 10 KiB | 807 | 783 |
| schema-kitchen-sink.graphql | H A D | 05-Feb-2020 | 1.3 KiB | 71 | 52 |
| schema.go | H A D | 05-Feb-2020 | 14.5 KiB | 551 | 434 |
| suggested_list_internal_test.go | H A D | 05-Feb-2020 | 821 | 29 | 26 |
| type_comparators_internal_test.go | H A D | 05-Feb-2020 | 4 KiB | 150 | 139 |
| type_info.go | H A D | 05-Feb-2020 | 7.6 KiB | 271 | 235 |
| types.go | H A D | 05-Feb-2020 | 537 | 20 | 12 |
| union_interface_test.go | H A D | 05-Feb-2020 | 14.1 KiB | 642 | 591 |
| util.go | H A D | 05-Feb-2020 | 3.5 KiB | 177 | 145 |
| util_test.go | H A D | 05-Feb-2020 | 3.9 KiB | 179 | 155 |
| validation_test.go | H A D | 05-Feb-2020 | 48.2 KiB | 1,647 | 1,581 |
| validator.go | H A D | 05-Feb-2020 | 8.6 KiB | 288 | 236 |
| validator_test.go | H A D | 05-Feb-2020 | 2.5 KiB | 98 | 83 |
| values.go | H A D | 05-Feb-2020 | 11.4 KiB | 428 | 358 |
| values_test.go | H A D | 05-Feb-2020 | 461 | 19 | 16 |
| variables_test.go | H A D | 05-Feb-2020 | 36.3 KiB | 1,469 | 1,334 |
README.md
1# graphql [![CircleCI](https://circleci.com/gh/graphql-go/graphql/tree/master.svg?style=svg)](https://circleci.com/gh/graphql-go/graphql/tree/master) [![GoDoc](https://godoc.org/graphql.co/graphql?status.svg)](https://godoc.org/github.com/graphql-go/graphql) [![Coverage Status](https://coveralls.io/repos/github/graphql-go/graphql/badge.svg?branch=master)](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](https://wehavefaces.net/learn-golang-graphql-relay-1-e59ea174a902)
75
76