omnia_wasi_sql/host/
resource.rs1use std::fmt::Debug;
2use std::ops::Deref;
3use std::sync::Arc;
4
5pub use omnia::FutureResult;
6
7use crate::host::{DataType, Row};
8
9pub trait Connection: Debug + Send + Sync + 'static {
13 fn query(&self, query: String, params: Vec<DataType>) -> FutureResult<Vec<Row>>;
15
16 fn exec(&self, query: String, params: Vec<DataType>) -> FutureResult<u32>;
18}
19
20#[derive(Clone, Debug)]
23pub struct ConnectionProxy(pub Arc<dyn Connection>);
24
25impl Deref for ConnectionProxy {
26 type Target = Arc<dyn Connection>;
27
28 fn deref(&self) -> &Self::Target {
29 &self.0
30 }
31}
32
33#[derive(Clone, Debug)]
35pub struct Statement {
36 pub query: String,
38
39 pub params: Vec<DataType>,
41}