teaql_runtime/repository/
executor.rs1use teaql_core::Record;
2use teaql_sql::CompiledQuery;
3
4pub trait QueryExecutor {
5 type Error: std::error::Error + Send + Sync + 'static;
6
7 fn fetch_all(&self, query: &CompiledQuery) -> Result<Vec<Record>, Self::Error>;
8 fn execute(&self, query: &CompiledQuery) -> Result<u64, Self::Error>;
9
10 fn begin_transaction(&self) -> Result<GraphTransactionBoundary, Self::Error> {
11 Ok(GraphTransactionBoundary::Unsupported)
12 }
13
14 fn commit_transaction(&self) -> Result<(), Self::Error> {
15 Ok(())
16 }
17
18 fn rollback_transaction(&self) -> Result<(), Self::Error> {
19 Ok(())
20 }
21}
22
23#[derive(Debug, Clone, Copy, PartialEq, Eq)]
24pub enum GraphTransactionBoundary {
25 Started,
26 AlreadyActive,
27 Unsupported,
28}