{"id":13366966,"url":"https://github.com/graphql-Go/graphql","last_synced_at":"2025-03-12T18:31:44.029Z","repository":{"id":37742804,"uuid":"39332913","full_name":"graphql-go/graphql","owner":"graphql-go","description":"An implementation of GraphQL for Go / Golang","archived":false,"fork":false,"pushed_at":"2025-01-11T19:05:36.000Z","size":3673,"stargazers_count":10008,"open_issues_count":233,"forks_count":842,"subscribers_count":142,"default_branch":"master","last_synced_at":"2025-03-11T00:40:42.086Z","etag":null,"topics":["graphql","graphql-go","subscriptions"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphql-go.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-19T12:25:43.000Z","updated_at":"2025-03-10T12:28:36.000Z","dependencies_parsed_at":"2022-07-14T08:49:33.481Z","dependency_job_id":"6d1a6690-e644-4cc1-8961-10c73bd6f262","html_url":"https://github.com/graphql-go/graphql","commit_stats":{"total_commits":693,"total_committers":99,"mean_commits":7.0,"dds":0.7835497835497836,"last_synced_commit":"a9741863816e423e4287fd8947731d637451cf6c"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-go%2Fgraphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-go%2Fgraphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-go%2Fgraphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-go%2Fgraphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-go","download_url":"https://codeload.github.com/graphql-go/graphql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243271353,"owners_count":20264443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","graphql-go","subscriptions"],"created_at":"2024-07-30T00:01:35.109Z","updated_at":"2025-03-12T18:31:43.581Z","avatar_url":"https://github.com/graphql-go.png","language":"Go","funding_links":[],"categories":["查询语言","查詢語言"],"sub_categories":["高级控制台界面","高級控制台界面"],"readme":"# graphql [![CircleCI](https://circleci.com/gh/graphql-go/graphql/tree/master.svg?style=svg)](https://circleci.com/gh/graphql-go/graphql/tree/master) [![Go Reference](https://pkg.go.dev/badge/github.com/graphql-go/graphql.svg)](https://pkg.go.dev/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\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nAn implementation of GraphQL in Go. Follows the official reference implementation [`graphql-js`](https://github.com/graphql/graphql-js).\n\nSupports: queries, mutations \u0026 subscriptions.\n\n### Documentation\n\ngodoc: https://pkg.go.dev/github.com/graphql-go/graphql\n\n### Getting Started\n\nTo install the library, run:\n```bash\ngo get github.com/graphql-go/graphql\n```\n\nThe 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.\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/graphql-go/graphql\"\n)\n\nfunc main() {\n\t// Schema\n\tfields := graphql.Fields{\n\t\t\"hello\": \u0026graphql.Field{\n\t\t\tType: graphql.String,\n\t\t\tResolve: func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn \"world\", nil\n\t\t\t},\n\t\t},\n\t}\n\trootQuery := graphql.ObjectConfig{Name: \"RootQuery\", Fields: fields}\n\tschemaConfig := graphql.SchemaConfig{Query: graphql.NewObject(rootQuery)}\n\tschema, err := graphql.NewSchema(schemaConfig)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create new schema, error: %v\", err)\n\t}\n\n\t// Query\n\tquery := `\n\t\t{\n\t\t\thello\n\t\t}\n\t`\n\tparams := graphql.Params{Schema: schema, RequestString: query}\n\tr := graphql.Do(params)\n\tif len(r.Errors) \u003e 0 {\n\t\tlog.Fatalf(\"failed to execute graphql operation, errors: %+v\", r.Errors)\n\t}\n\trJSON, _ := json.Marshal(r)\n\tfmt.Printf(\"%s \\n\", rJSON) // {\"data\":{\"hello\":\"world\"}}\n}\n```\nFor 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).\n\n### Third Party Libraries\n| Name          | Author        | Description  |\n|:-------------:|:-------------:|:------------:|\n| [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. |\n| [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. |\n| [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. |\n| [dataloader](https://github.com/nicksrandall/dataloader) | [Nick Randall](https://github.com/nicksrandall) | [DataLoader](https://github.com/facebook/dataloader) implementation in Go. |\n\n### Blog Posts\n- [Golang + GraphQL + Relay](https://wehavefaces.net/learn-golang-graphql-relay-1-e59ea174a902)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-Go%2Fgraphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-Go%2Fgraphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-Go%2Fgraphql/lists"}