use std::sync::Arc;
use anyhow::Result;
use kotoba_storage::KeyValueStore;
use crate::ProjectionEngine;
pub struct ProjectionEngineAdapter<T: KeyValueStore> {
projection_engine: Arc<ProjectionEngine<T>>,
}
impl<T: KeyValueStore + 'static> ProjectionEngineAdapter<T> {
pub fn new(projection_engine: Arc<ProjectionEngine<T>>) -> Self {
Self { projection_engine }
}
pub async fn execute_gql_query(
&self,
query: &str,
_context: serde_json::Value,
) -> Result<serde_json::Value> {
self.projection_engine.query_projections(serde_json::json!({"query": query})).await
}
pub async fn execute_gql_statement(
&self,
statement: &str,
_context: serde_json::Value,
) -> Result<serde_json::Value> {
Ok(serde_json::json!({
"statement": statement,
"status": "not_implemented",
"message": "GQL statement execution is not fully implemented yet"
}))
}
}