reactive_graph_plugin_delegates/
graphql_query_service_impl.rs1use async_trait::async_trait;
2
3use reactive_graph_graphql_api::GraphQLQueryService;
4use serde_json::Error;
5use std::sync::Arc;
6
7pub struct GraphQLQueryServiceDelegate {
8 graphql_query_service: Arc<dyn GraphQLQueryService + Send + Sync>,
9}
10
11impl GraphQLQueryServiceDelegate {
12 pub fn new(graphql_query_service: Arc<dyn GraphQLQueryService + Send + Sync>) -> Self {
13 Self { graphql_query_service }
14 }
15}
16
17#[async_trait]
18impl reactive_graph_plugin_api::GraphQLQueryService for GraphQLQueryServiceDelegate {
19 async fn query(&self, request: &str) -> Result<String, Error> {
20 self.graphql_query_service.query(request).await
21 }
22}