Graphql介绍(Introduction to GraphQL)
Posted 霓裳梦竹
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Graphql介绍(Introduction to GraphQL)相关的知识,希望对你有一定的参考价值。
Introduction to GraphQL
me
) as well as that User‘s name might look something like this:type Query { me: User } type User { id: ID name: String }
Along with functions for each field on each type:
以及每一个字段的每个类型的函数:
1 function Query_me(request) { 2 return request.auth.user; 3 } 4 5 function User_name(user) { 6 return user.getName(); 7 }
Once a GraphQL service is running (typically at a URL on a web service), it can be sent GraphQL queries to validate and execute. A received query is first checked to ensure it only refers to the types and fields defined, then runs the provided functions to produce a result.
一旦一个GraplQl服务在运行(尤其是在一个web服务器上的URL地址),它将会发送GraphQL查询去验证和执行。一个接收到的查询首先去检查并确保它仅仅是引用定义的type和fields,之后再运行提供的函数去生成一个结果。
For example the query:
例如:
{
me {
name
}
}
Could produce the JSON result:
将产生的JSON结果:
{
"me": {
"name": "Luke Skywalker"
}
}
Learn more about GraphQL: the query language, type system, how the GraphQL service works, and as well as best practices for using GraphQL to solve common problems in the articles written in this section.
学习更多的关于GraphQl:查询语言,type系统,GraphQl服务如何工作,以及使用GraphQl去解决这个文章中的通用问题的最佳实践。
以上是关于Graphql介绍(Introduction to GraphQL)的主要内容,如果未能解决你的问题,请参考以下文章
条件随机场介绍—— An Introduction to Conditional Random Fields
Introduction to Logistic Regression(逻辑回归介绍)
译提升树算法的介绍(Introduction to Boosted Trees)