From c70e403266b7a718273f390e75cce3291d438d07 Mon Sep 17 00:00:00 2001 From: Jeff Baskin Date: Mon, 27 Jun 2022 12:15:12 -0400 Subject: [PATCH] Added GraphQL query function. --- src/lib.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index a9769d7..72f49ed 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,4 +5,26 @@ impl Database { pub fn new() -> Self { Self {} } + + pub async fn query(&self, _qry: &str) -> String { + "{data{}}".to_string() + } +} + +#[cfg(test)] +mod queries { + use super::*; + + #[async_std::test] + async fn empty_table_query() { + let expected = "{data{}}"; + let testdb = Database::new(); + let output = testdb.query("{tables{name}}").await; + assert!( + output == expected, + "Got '{}' expected '{}'.", + output, + expected + ); + } }