1use async_trait::async_trait;
3use ecat_errors::Error;
4
5#[async_trait]
7pub trait DocumentClient: Send + Sync {
8 async fn insert(&self, collection: &str, doc: &serde_json::Value) -> Result<String, Error>;
10
11 async fn find(
13 &self,
14 collection: &str,
15 filter: &serde_json::Value,
16 ) -> Result<Vec<serde_json::Value>, Error>;
17
18 async fn update(
20 &self,
21 collection: &str,
22 filter: &serde_json::Value,
23 update: &serde_json::Value,
24 ) -> Result<u64, Error>;
25
26 async fn delete(&self, collection: &str, filter: &serde_json::Value) -> Result<u64, Error>;
28}