Merge branch 'master' of github.com-koxiaet:async-graphql/async-graphql into master
This commit is contained in:
commit
f1af4ea195
4
.github/workflows/code-coverage.yml
vendored
4
.github/workflows/code-coverage.yml
vendored
|
@ -10,10 +10,6 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
override: true
|
|
||||||
- name: Install libsqlite3-dev
|
- name: Install libsqlite3-dev
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "async-graphql"
|
name = "async-graphql"
|
||||||
version = "1.17.21"
|
version = "1.18.0"
|
||||||
authors = ["sunli <scott_s829@163.com>"]
|
authors = ["sunli <scott_s829@163.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "A GraphQL server library implemented in Rust"
|
description = "A GraphQL server library implemented in Rust"
|
||||||
|
@ -17,10 +17,9 @@ readme = "README.md"
|
||||||
default = ["bson", "url", "chrono-tz"]
|
default = ["bson", "url", "chrono-tz"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql-derive = { path = "derive", version = "1.17.21" }
|
async-graphql-derive = { path = "derive", version = "1.18.0" }
|
||||||
async-graphql-parser = { path = "parser", version = "1.17.3" }
|
async-graphql-parser = { path = "parser", version = "1.18.0" }
|
||||||
|
|
||||||
Inflector = "0.11.4"
|
|
||||||
anyhow = "1.0.26"
|
anyhow = "1.0.26"
|
||||||
async-stream = "0.2.1"
|
async-stream = "0.2.1"
|
||||||
async-trait = "0.1.30"
|
async-trait = "0.1.30"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "graphql-benchmark"
|
name = "graphql-benchmark"
|
||||||
version = "1.17.3"
|
version = "1.18.0"
|
||||||
authors = ["sunli <scott_s829@163.com>"]
|
authors = ["sunli <scott_s829@163.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "async-graphql-derive"
|
name = "async-graphql-derive"
|
||||||
version = "1.17.21"
|
version = "1.18.0"
|
||||||
authors = ["sunli <scott_s829@163.com>"]
|
authors = ["sunli <scott_s829@163.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Macros for async-graphql"
|
description = "Macros for async-graphql"
|
||||||
|
@ -16,7 +16,7 @@ categories = ["network-programming", "asynchronous"]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql-parser = { path = "../parser", version = "1.17.2" }
|
async-graphql-parser = { path = "../parser", version = "1.18.0" }
|
||||||
proc-macro2 = "1.0.6"
|
proc-macro2 = "1.0.6"
|
||||||
syn = { version = "1.0.20", features = ["full", "extra-traits"] }
|
syn = { version = "1.0.20", features = ["full", "extra-traits"] }
|
||||||
quote = "1.0.3"
|
quote = "1.0.3"
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql = "1.17.15"
|
async-graphql = "1.18.0"
|
||||||
async-graphql-actix-web = "1.17.3" # If you need to integrate into actix-web
|
async-graphql-actix-web = "1.18.0" # If you need to integrate into actix-web
|
||||||
async-graphql-warp = "1.17.3" # If you need to integrate into warp
|
async-graphql-warp = "1.18.0" # If you need to integrate into warp
|
||||||
async-graphql-tide = "1.17.9" # If you need to integrate into tide
|
async-graphql-tide = "1.18.0" # If you need to integrate into tide
|
||||||
```
|
```
|
||||||
|
|
||||||
## Write a Schema
|
## Write a Schema
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql = "1.11.0"
|
async-graphql = "1.18.0"
|
||||||
async-graphql-actix-web = "1.3.0" # 如果你需要集成到Actix-web
|
async-graphql-actix-web = "1.18.0" # 如果你需要集成到Actix-web
|
||||||
async-graphql-warp = "1.3.0" # 如果你需要集成到Warp
|
async-graphql-warp = "1.18.0" # 如果你需要集成到Warp
|
||||||
async-graphql-tide = "1.2.0" # 如果你需要集成到Tide
|
async-graphql-tide = "1.18.0" # 如果你需要集成到Tide
|
||||||
```
|
```
|
||||||
|
|
||||||
## 写一个Schema
|
## 写一个Schema
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "async-graphql-actix-web"
|
name = "async-graphql-actix-web"
|
||||||
version = "1.17.18"
|
version = "1.18.0"
|
||||||
authors = ["sunli <scott_s829@163.com>"]
|
authors = ["sunli <scott_s829@163.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "async-graphql for actix-web"
|
description = "async-graphql for actix-web"
|
||||||
|
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql = { path = "../..", version = "1.17.2" }
|
async-graphql = { path = "../..", version = "1.18.0" }
|
||||||
actix-web = "2.0.0"
|
actix-web = "2.0.0"
|
||||||
actix-web-actors = "2.0.0"
|
actix-web-actors = "2.0.0"
|
||||||
actix = "0.9.0"
|
actix = "0.9.0"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "async-graphql-lambda"
|
name = "async-graphql-lambda"
|
||||||
version = "1.14.0"
|
version = "1.18.0"
|
||||||
authors = ["Sunli <scott_s829@163.com>"]
|
authors = ["Sunli <scott_s829@163.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "async-graphql for AWS Lambda"
|
description = "async-graphql for AWS Lambda"
|
||||||
|
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql = { path = "../..", version = "1.17.2" }
|
async-graphql = { path = "../..", version = "1.18.0" }
|
||||||
lambda_http = { git = "https://github.com/awslabs/aws-lambda-rust-runtime" }
|
lambda_http = { git = "https://github.com/awslabs/aws-lambda-rust-runtime" }
|
||||||
futures = "0.3.0"
|
futures = "0.3.0"
|
||||||
async-trait = "0.1.30"
|
async-trait = "0.1.30"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "async-graphql-rocket"
|
name = "async-graphql-rocket"
|
||||||
version = "1.17.21"
|
version = "1.18.0"
|
||||||
authors = ["Daniel Wiesenberg <daniel@simplificAR.io>"]
|
authors = ["Daniel Wiesenberg <daniel@simplificAR.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "async-graphql for Rocket.rs"
|
description = "async-graphql for Rocket.rs"
|
||||||
|
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql", "rocket"]
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql = { path = "../..", version = "1.17.21" }
|
async-graphql = { path = "../..", version = "1.18.0" }
|
||||||
rocket = { git = "https://github.com/SergioBenitez/Rocket/", rev = "dc2c6ec", default-features = false } #TODO: Change to Cargo crate, when Rocket 0.5.0 is released
|
rocket = { git = "https://github.com/SergioBenitez/Rocket/", rev = "dc2c6ec", default-features = false } #TODO: Change to Cargo crate, when Rocket 0.5.0 is released
|
||||||
log = "0.4.11"
|
log = "0.4.11"
|
||||||
yansi = "0.5.0"
|
yansi = "0.5.0"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "async-graphql-tide"
|
name = "async-graphql-tide"
|
||||||
version = "1.17.9"
|
version = "1.18.0"
|
||||||
authors = ["vkill <vkill.net@gmail.com>"]
|
authors = ["vkill <vkill.net@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "async-graphql for tide"
|
description = "async-graphql for tide"
|
||||||
|
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql = { path = "../..", version = "1.17.2" }
|
async-graphql = { path = "../..", version = "1.18.0" }
|
||||||
tide = "0.13.0"
|
tide = "0.13.0"
|
||||||
async-trait = "0.1.36"
|
async-trait = "0.1.36"
|
||||||
serde_json = "1.0.56"
|
serde_json = "1.0.56"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "async-graphql-warp"
|
name = "async-graphql-warp"
|
||||||
version = "1.17.18"
|
version = "1.18.0"
|
||||||
authors = ["sunli <scott_s829@163.com>"]
|
authors = ["sunli <scott_s829@163.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "async-graphql for warp"
|
description = "async-graphql for warp"
|
||||||
|
@ -13,7 +13,7 @@ keywords = ["futures", "async", "graphql"]
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql = { path = "../..", version = "1.17.2" }
|
async-graphql = { path = "../..", version = "1.18.0" }
|
||||||
warp = "0.2.2"
|
warp = "0.2.2"
|
||||||
futures = "0.3.0"
|
futures = "0.3.0"
|
||||||
bytes = "0.5.4"
|
bytes = "0.5.4"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "async-graphql-parser"
|
name = "async-graphql-parser"
|
||||||
version = "1.17.3"
|
version = "1.18.0"
|
||||||
authors = ["sunli <scott_s829@163.com>"]
|
authors = ["sunli <scott_s829@163.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "GraphQL query parser for async-graphql"
|
description = "GraphQL query parser for async-graphql"
|
||||||
|
|
|
@ -140,7 +140,8 @@ impl<'a> Display for QueryPathNode<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> QueryPathNode<'a> {
|
impl<'a> QueryPathNode<'a> {
|
||||||
pub(crate) fn field_name(&self) -> &str {
|
/// Get the current field name.
|
||||||
|
pub fn field_name(&self) -> &str {
|
||||||
let mut p = self;
|
let mut p = self;
|
||||||
loop {
|
loop {
|
||||||
if let QueryPathSegment::Name(name) = &p.segment {
|
if let QueryPathSegment::Name(name) = &p.segment {
|
||||||
|
|
|
@ -5,7 +5,7 @@ mod logger;
|
||||||
mod tracing;
|
mod tracing;
|
||||||
|
|
||||||
use crate::context::{QueryPathNode, ResolveId};
|
use crate::context::{QueryPathNode, ResolveId};
|
||||||
use crate::{Result, Variables};
|
use crate::{Context, Result, Variables};
|
||||||
|
|
||||||
pub use self::apollo_tracing::ApolloTracing;
|
pub use self::apollo_tracing::ApolloTracing;
|
||||||
pub use self::logger::Logger;
|
pub use self::logger::Logger;
|
||||||
|
@ -28,6 +28,9 @@ pub struct ResolveInfo<'a> {
|
||||||
/// Current path node, You can go through the entire path.
|
/// Current path node, You can go through the entire path.
|
||||||
pub path_node: &'a QueryPathNode<'a>,
|
pub path_node: &'a QueryPathNode<'a>,
|
||||||
|
|
||||||
|
/// Context
|
||||||
|
pub context: &'a Context<'a>,
|
||||||
|
|
||||||
/// Parent type
|
/// Parent type
|
||||||
pub parent_type: &'a str,
|
pub parent_type: &'a str,
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ fn do_resolve<'a, T: ObjectType + Send + Sync>(
|
||||||
let resolve_info = ResolveInfo {
|
let resolve_info = ResolveInfo {
|
||||||
resolve_id: ctx_field.resolve_id,
|
resolve_id: ctx_field.resolve_id,
|
||||||
path_node: ctx_field.path_node.as_ref().unwrap(),
|
path_node: ctx_field.path_node.as_ref().unwrap(),
|
||||||
|
context: &ctx_field,
|
||||||
parent_type: &T::type_name(),
|
parent_type: &T::type_name(),
|
||||||
return_type: match ctx_field
|
return_type: match ctx_field
|
||||||
.schema_env
|
.schema_env
|
||||||
|
|
|
@ -95,6 +95,7 @@ pub fn collect_fields<'a, T: ObjectType + Send + Sync>(
|
||||||
let resolve_info = ResolveInfo {
|
let resolve_info = ResolveInfo {
|
||||||
resolve_id: ctx_field.resolve_id,
|
resolve_id: ctx_field.resolve_id,
|
||||||
path_node: ctx_field.path_node.as_ref().unwrap(),
|
path_node: ctx_field.path_node.as_ref().unwrap(),
|
||||||
|
context: &ctx_field,
|
||||||
parent_type: &T::type_name(),
|
parent_type: &T::type_name(),
|
||||||
return_type: match ctx_field
|
return_type: match ctx_field
|
||||||
.schema_env
|
.schema_env
|
||||||
|
|
Loading…
Reference in New Issue
Block a user