clickhouse_client/intf/
mod.rs1use async_trait::async_trait;
6
7use crate::{
8 error::Error,
9 query::{Query, QueryResponse},
10 Client,
11};
12
13pub mod http;
14
15#[async_trait]
17pub trait Interface: Send + Sync {
18 async fn ping(&self) -> bool;
20
21 async fn send(&self, query: Query) -> Result<QueryResponse, Error>;
23}
24
25impl<T> Client<T>
26where
27 T: Interface,
28{
29 #[tracing::instrument(skip_all)]
31 pub async fn ping(&self) -> bool {
32 self.interface.ping().await
33 }
34
35 pub async fn send(&self, query: Query) -> Result<QueryResponse, Error> {
37 self.interface.send(query).await
38 }
39}