diff --git a/src/lib.rs b/src/lib.rs
index 2956661..1f8dfe5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,8 @@
-use async_graphql::{EmptySubscription, Object, Result, Schema};
+use async_graphql::{Context, EmptySubscription, Object, Result, Schema};
+use async_std::sync::RwLock;
use serde_json;
+#[derive(Clone)]
struct Table {
name: String,
}
@@ -25,14 +27,25 @@ impl Query {
async fn pointless(&self) -> String {
"this is pointless.".to_string()
}
+
+ async fn tables(&self, ctx: &Context<'_>) -> Vec
{
+ ctx.data::>>()
+ .unwrap()
+ .read()
+ .await
+ .to_vec()
+ }
}
struct Mutation;
#[Object]
impl Mutation {
- async fn create_table(&self, name: String) -> Result