From 185ba5270aaf94de9b91e4455be27db5198ec21e Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 21 Aug 2024 11:59:50 +0200 Subject: Reformat graphql mod --- src/graphql.rs | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 src/graphql.rs (limited to 'src/graphql.rs') diff --git a/src/graphql.rs b/src/graphql.rs deleted file mode 100644 index 2843156..0000000 --- a/src/graphql.rs +++ /dev/null @@ -1,48 +0,0 @@ -use std::sync::Arc; - -use async_graphql::{Context, EmptyMutation, EmptySubscription, Object, Schema}; -use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; - -// use crate::state::AppState; - -pub struct Query; - -#[Object] -impl Query { - async fn api_version(&self) -> &'static str { - "1.0" - } - - /// Returns the sum of a and b - async fn add<'ctx>( - &self, - _ctx: &Context<'ctx>, - #[graphql(desc = "First value")] a: i32, - #[graphql(desc = "Second value")] b: Option, - ) -> i32 { - // let state = ctx.data::().unwrap(); - // let client = &*state.client; - // - // // Perform a database query - // let rows = client - // .query("SELECT owner FROM payment", &[]) - // .await - // .unwrap(); - // for row in rows { - // let owner: String = row.get(0); - // println!("{owner}"); - // } - - match b { - Some(x) => a + x, - None => a, - } - } -} - -pub async fn graphql_handler( - schema: Arc>, - req: GraphQLRequest, -) -> GraphQLResponse { - schema.execute(req.into_inner()).await.into() -} -- cgit v1.2.3-18-g5258