GraphQL是什么

GraphQL 是 API 查询语言,SQL (Structured Query Language) 是结构化查询语言的简称,Graph+ QL =图表化(可视化)查询语言,描述客户端如何向服务端请求数据的API语法,类似于 RESTful API 规范
Facebook的GraphQL规范
http://facebook.github.io/graphql/October2016/
官网
http://graphql.org/
国内
https://graphql.cn
https://graphql.cn/learn/
https://graphql.cn/code/#go
GraphQL 不和任何特定数据库或者存储引擎绑定,依靠现有的代码和数据支撑
GraphQL的场景在于赋能前端开发,赋予了前端开发者自由组织和定制请求数据的能力
GraphQL 服务通过定义类型和类型上的字段来创建,给每个类型的每个字段提供解析函数
GraphQL 服务告诉当前登录用户是 me 这个用户的名称像这样
type Query {
  me: User
}
type User {
  id: ID
  name: String
}
每个类型字段的解析函数
function Query_me(request) {
  return request.auth.user;
}
function User_name(user) {
  return user.getName();
}
GraphQL 服务(web 服务的URL上)
接收 GraphQL 查询,验证和执行
接收到的查询被检查确保 只引用了已定义的类型和字段, 运行指定的解析函数来生成结果
{
  me {
    name
  }
}
产生JSON结果
{
  "me": {
    "name": "Luke Skywalker"
  }
}
GraphQL多编程语言支持, 流行的服务端框架、客户端库、服务和其他有用的内容 这里列出Golang的
服务端库
https://github.com/graphql-go/graphql
graphql-go
一个 Go/Golang 的 GraphQL 实现

https://github.com/graph-gophers/graphql-go
graphql-go
一个活跃的 Golang GraphQL 实现

https://github.com/99designs/gqlgen
gqlgen
生成基于 graphql 的服务器的库

https://github.com/graphql-go/relay
graphql-relay-go
一个用于帮助构建 graphql-go 服务器的 Go/Golang 库,支持 react-relay

https://github.com/machinebox/graphql
machinebox/graphql
用于 GraphQL 的一个优雅的底层 HTTP 客户端

https://github.com/samsarahq/thunder
samsarahq/thunder
可轻松进行 schema 构建、实时查询和批处理的 GraphQL 实现

https://github.com/appointy/jaal
appointy/jaal
在 Go 中开发符合规范的 GraphQL 服务器
GraphQL 客户端
graphql
一个使用 Go 编写的 GraphQL 客户端实现。
https://github.com/shurcooL/graphql#readme

Go Libraries
https://github.com/graphql-go/graphql
graphql
An implementation of GraphQL for Go follows graphql-js

https://github.com/graph-gophers/graphql-go
graphql-go
GraphQL server with a focus on ease of use.

https://github.com/99designs/gqlgen
GQLGen
Go generate based graphql server library.

https://github.com/machinebox/graphql
machinebox/graphql
Simple low-level GraphQL client for Go

https://github.com/graphql-go/relay
graphql-relay-go
A Go/Golang library to help construct a server supporting react-relay.

https://github.com/tmc/graphql
graphql
GraphQL parser and server for Go.

https://github.com/tecbot/c-graphqlparser
c-graphqlparser
Go-gettable version of the libgraphqlparser C library for parsing GraphQL.

https://github.com/tallstreet/graphql
tallstreet-graphql
GraphQL parser and server for Go that leverages libgraphqlparser

https://github.com/playlyfe/go-graphql
go-graphql
A powerful GraphQL server implementation for Golang