1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use Future;
use Pin;
use cratePipelineError;
/// Backend-agnostic query execution trait.
///
/// Implement this trait to provide a custom database backend for the query pipeline.
/// The built-in `TypeDBClient` (behind the `typedb` feature) implements this trait.
///
/// # Example
///
/// ```rust,ignore
/// use type_bridge_server::{QueryExecutor, PipelineError};
/// use std::pin::Pin;
/// use std::future::Future;
///
/// struct MockExecutor;
///
/// impl QueryExecutor for MockExecutor {
/// fn execute<'a>(&'a self, _database: &'a str, typeql: &'a str, _transaction_type: &'a str)
/// -> Pin<Box<dyn Future<Output = Result<serde_json::Value, PipelineError>> + Send + 'a>>
/// {
/// Box::pin(async move {
/// Ok(serde_json::json!([{"query": typeql}]))
/// })
/// }
/// fn is_connected(&self) -> bool { true }
/// }
/// ```