Skip to main content

uqa_sql/
async_sql_engine.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7use std::future::Future;
8
9use crate::{SQLParam, SQLResult};
10
11/// Common asynchronous SQL interface implemented by embedded and HTTP engines.
12pub trait AsyncSQLEngine {
13    type Error;
14
15    fn sql<'a>(
16        &'a self,
17        query: &'a str,
18        params: &'a [SQLParam],
19    ) -> impl Future<Output = Result<SQLResult, Self::Error>> + Send + 'a;
20
21    fn sql_batch<'a>(
22        &'a self,
23        statements: &'a [(&'a str, &'a [SQLParam])],
24    ) -> impl Future<Output = Result<Vec<SQLResult>, Self::Error>> + Send + 'a;
25}