1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

Correct some items' name to fix the build (#370)

This commit is contained in:
Yuki Okushi
2020-09-20 06:17:56 +09:00
committed by GitHub
parent a1f2f9514e
commit b727e796b9
3 changed files with 229 additions and 14 deletions

View File

@ -6,6 +6,8 @@ edition = "2018"
[dependencies]
actix-web = "3.0.0"
async-graphql = "2.0.0-alpha.7"
async-graphql-actix-web = "2.0.0-alpha.7"
async-graphql = "=2.0.0-alpha.13"
async-graphql-actix-web = "=2.0.0-alpha.13"
slab = "0.4.2"

View File

@ -1,9 +1,9 @@
use super::StarWars;
use async_graphql::connection::{query, Connection, Edge, EmptyFields};
use async_graphql::{Context, FieldResult, GQLEnum, GQLInterface, GQLObject};
use async_graphql::{Context, Enum, FieldResult, Interface, Object};
/// One of the films in the Star Wars Trilogy
#[derive(GQLEnum, Copy, Clone, Eq, PartialEq)]
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
pub enum Episode {
/// Released in 1977.
NewHope,
@ -18,7 +18,7 @@ pub enum Episode {
pub struct Human(usize);
/// A humanoid creature in the Star Wars universe.
#[GQLObject]
#[Object]
impl Human {
/// The id of the human.
async fn id(&self, ctx: &Context<'_>) -> &str {
@ -53,7 +53,7 @@ impl Human {
pub struct Droid(usize);
/// A mechanical creature in the Star Wars universe.
#[GQLObject]
#[Object]
impl Droid {
/// The id of the droid.
async fn id(&self, ctx: &Context<'_>) -> &str {
@ -87,7 +87,7 @@ impl Droid {
pub struct QueryRoot;
#[GQLObject]
#[Object]
impl QueryRoot {
async fn hero(
&self,
@ -159,7 +159,7 @@ impl QueryRoot {
}
}
#[derive(GQLInterface)]
#[derive(Interface)]
#[graphql(
field(name = "id", type = "&str", context),
field(name = "name", type = "&str", context),