pub struct DocumentStore { /* private fields */ }
Implementations§
Source§impl DocumentStore
impl DocumentStore
Sourcepub async fn new(database_url: &str) -> Result<Self>
pub async fn new(database_url: &str) -> Result<Self>
Create a new DocumentStore with automatic database creation and migrations
Sourcepub async fn from_pool(pool: SqlitePool) -> Result<Self>
pub async fn from_pool(pool: SqlitePool) -> Result<Self>
Create a DocumentStore from an existing pool (useful for testing)
Sourcepub fn pool(&self) -> &SqlitePool
pub fn pool(&self) -> &SqlitePool
Get the underlying database pool
Sourcepub fn query_service(&self) -> QueryService
pub fn query_service(&self) -> QueryService
Create a QueryService using this DocumentStore’s database pool
Sourcepub async fn store_document(&self, filepath: &Path) -> Result<Document>
pub async fn store_document(&self, filepath: &Path) -> Result<Document>
Store a document by reading and parsing the file at the given path
Sourcepub async fn get_document(&self, document_id: &str) -> Result<Option<Document>>
pub async fn get_document(&self, document_id: &str) -> Result<Option<Document>>
Get a document by ID
Sourcepub async fn update_document(&self, filepath: &Path) -> Result<Document>
pub async fn update_document(&self, filepath: &Path) -> Result<Document>
Update an existing document by re-reading the file
Sourcepub async fn delete_document(&self, document_id: &str) -> Result<bool>
pub async fn delete_document(&self, document_id: &str) -> Result<bool>
Delete a document by ID
Trait Implementations§
Source§impl Clone for DocumentStore
impl Clone for DocumentStore
Source§fn clone(&self) -> DocumentStore
fn clone(&self) -> DocumentStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for DocumentStore
impl !RefUnwindSafe for DocumentStore
impl Send for DocumentStore
impl Sync for DocumentStore
impl Unpin for DocumentStore
impl !UnwindSafe for DocumentStore
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more