use async_trait::async_trait;
use serde::{Deserialize, Serialize};
pub mod manager;
#[async_trait]
pub trait Manager {
async fn find_doc_mpath_by_url(&self, url: &str, stele: &str) -> anyhow::Result<String>;
}
#[async_trait]
pub trait TxManager {
async fn insert_bulk(&mut self, document_elements: Vec<DocumentElement>) -> anyhow::Result<()>;
}
#[derive(sqlx::FromRow, Deserialize, Serialize)]
pub struct DocumentElement {
pub doc_mpath: String,
pub url: String,
pub doc_id: String,
pub stele: String,
}
impl DocumentElement {
#[must_use]
pub const fn new(doc_mpath: String, url: String, doc_id: String, stele: String) -> Self {
Self {
doc_mpath,
url,
doc_id,
stele,
}
}
}