pub struct SyncService<'a> { /* private fields */ }
Expand description
Synchronization service - bridges filesystem and database
Implementations§
Source§impl<'a> SyncService<'a>
impl<'a> SyncService<'a>
pub fn new(db_service: &'a mut DatabaseService) -> Self
Sourcepub async fn import_from_file<P: AsRef<Path>>(
&mut self,
file_path: P,
) -> Result<Document>
pub async fn import_from_file<P: AsRef<Path>>( &mut self, file_path: P, ) -> Result<Document>
Direction 1: File → DocumentObject → Database Load a document from filesystem and store in database
Sourcepub async fn export_to_file(&mut self, filepath: &str) -> Result<()>
pub async fn export_to_file(&mut self, filepath: &str) -> Result<()>
Direction 2: Database → DocumentObject → File
Export a document from database to filesystem
Sourcepub async fn sync_file<P: AsRef<Path>>(
&mut self,
file_path: P,
) -> Result<SyncResult>
pub async fn sync_file<P: AsRef<Path>>( &mut self, file_path: P, ) -> Result<SyncResult>
Synchronize a single file between filesystem and database using directional methods
Sourcepub async fn sync_directory<P: AsRef<Path>>(
&mut self,
dir_path: P,
) -> Result<Vec<SyncResult>>
pub async fn sync_directory<P: AsRef<Path>>( &mut self, dir_path: P, ) -> Result<Vec<SyncResult>>
Sync all markdown files in a directory
Auto Trait Implementations§
impl<'a> Freeze for SyncService<'a>
impl<'a> !RefUnwindSafe for SyncService<'a>
impl<'a> Send for SyncService<'a>
impl<'a> !Sync for SyncService<'a>
impl<'a> Unpin for SyncService<'a>
impl<'a> !UnwindSafe for SyncService<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
Convert
self
to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
Convert
&self
to an expression for Diesel’s query builder. Read more